ce9413e0dd
* refactor: turn enum into const assertion * feat: add web3 to icon list * fix: type * fix: type cast query params and add category list * fix: conditional rendering * feat: add i18n keys * fix: type errors Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
21 lines
619 B
TypeScript
21 lines
619 B
TypeScript
import z from "zod";
|
|
|
|
import { InstalledAppVariants } from "../utils";
|
|
|
|
const variantSchema = z.enum(InstalledAppVariants);
|
|
|
|
export default function getInstalledAppPath(
|
|
{ variant, slug }: { variant?: string; slug?: string },
|
|
locationSearch = ""
|
|
): string {
|
|
if (!variant) return `/apps/installed${locationSearch}`;
|
|
|
|
const parsedVariant = variantSchema.safeParse(variant);
|
|
|
|
if (!parsedVariant.success) return `/apps/installed${locationSearch}`;
|
|
|
|
if (!slug) return `/apps/installed/${variant}${locationSearch}`;
|
|
|
|
return `/apps/installed/${variant}?hl=${slug}${locationSearch && locationSearch.slice(1)}`;
|
|
}
|