set useQueryParam to false for app categories (#6330)

* set useQueryParam to false for app categories

* New param 'useQueryParam' for AppCategoryNavigation/AdminAppsList

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
Alex van Andel 2023-01-07 23:21:21 +00:00 committed by GitHub
parent 6dc4211d81
commit 1ad6bba0ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View File

@ -27,7 +27,7 @@ export default function Setup(props: inferSSRProps<typeof getServerSideProps>) {
{
title: t("enable_apps"),
description: t("enable_apps_description"),
content: <AdminAppsList baseURL="/auth/setup?step=2" />,
content: <AdminAppsList baseURL="/auth/setup?step=2" useQueryParam={true} />,
isLoading: false,
},
];

View File

@ -12,15 +12,17 @@ const AppCategoryNavigation = ({
containerClassname,
className,
fromAdmin,
useQueryParam = false,
}: {
baseURL: string;
children: React.ReactNode;
containerClassname: string;
className?: string;
fromAdmin?: boolean;
useQueryParam?: boolean;
}) => {
const [animationRef] = useAutoAnimate<HTMLDivElement>();
const appCategories = useMemo(() => getAppCategories(baseURL), [baseURL]);
const appCategories = useMemo(() => getAppCategories(baseURL, useQueryParam), [baseURL, useQueryParam]);
return (
<div className={classNames("flex flex-col p-2 md:p-0 xl:flex-row", className)}>

View File

@ -7,7 +7,7 @@ function getHref(baseURL: string, category: string, useQueryParam: boolean) {
return useQueryParam ? `${baseUrlParsed.toString()}` : `${baseURL}/${category}`;
}
const getAppCategories = (baseURL: string, useQueryParam = true) => {
const getAppCategories = (baseURL: string, useQueryParam: boolean) => {
return [
{
name: "calendar",

View File

@ -174,7 +174,15 @@ const querySchema = z.object({
.default(AppCategories.calendar),
});
const AdminAppsList = ({ baseURL, className }: { baseURL: string; className?: string }) => {
const AdminAppsList = ({
baseURL,
className,
useQueryParam = false,
}: {
baseURL: string;
className?: string;
useQueryParam?: boolean;
}) => {
const router = useRouter();
return (
<form
@ -187,6 +195,7 @@ const AdminAppsList = ({ baseURL, className }: { baseURL: string; className?: st
<AppCategoryNavigation
baseURL={baseURL}
fromAdmin
useQueryParam={useQueryParam}
containerClassname="w-full xl:mx-5 xl:w-2/3 xl:pr-5"
className={className}>
<AdminAppsListContainer />