robodev 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/emit-starter.test.ts +36 -0
- package/templates/auth-chat/package.json +1 -1
- package/templates/backend/api/_lib.ts +9 -2
- package/templates/backend/package.json +1 -1
- package/templates/catalog.json +5 -0
- package/templates/empty/package.json +1 -1
- package/templates/marketplace/.config/local.spa.template.yml +27 -0
- package/templates/marketplace/.oxlint-base.json +29 -0
- package/templates/marketplace/.oxlintrc.json +78 -0
- package/templates/marketplace/.rulesync/rules/frontend-api-boundary.md +36 -0
- package/templates/marketplace/.rulesync/rules/frontend-component-structure.md +38 -0
- package/templates/marketplace/.rulesync/rules/frontend-forms.md +32 -0
- package/templates/marketplace/.rulesync/rules/frontend-notifications.md +24 -0
- package/templates/marketplace/.rulesync/rules/frontend-povio-components.md +42 -0
- package/templates/marketplace/.rulesync/rules/frontend-povio-ui.md +45 -0
- package/templates/marketplace/.rulesync/rules/frontend-query-autocomplete.md +29 -0
- package/templates/marketplace/.rulesync/rules/frontend-tables-and-lists.md +34 -0
- package/templates/marketplace/.rulesync/rules/frontend-translations.md +26 -0
- package/templates/marketplace/.rulesync/rules/project-overview.md +32 -0
- package/templates/marketplace/.rulesync/rules/robodev-api.md +30 -0
- package/templates/marketplace/.rulesync/rules/robodev-auth.md +40 -0
- package/templates/marketplace/.rulesync/rules/robodev-database.md +22 -0
- package/templates/marketplace/.rulesync/rules/role-based-app-structure.md +36 -0
- package/templates/marketplace/.rulesync/skills/media-feature/SKILL.md +21 -0
- package/templates/marketplace/.rulesync/skills/povio-ui-styling/SKILL.md +208 -0
- package/templates/marketplace/.rulesync/skills/povio-ui-styling/agents/openai.yaml +4 -0
- package/templates/marketplace/.rulesync/skills/robodev-api-route/SKILL.md +13 -0
- package/templates/marketplace/.rulesync/skills/robodev-table/SKILL.md +12 -0
- package/templates/marketplace/README.md +40 -0
- package/templates/marketplace/api/_lib.ts +677 -0
- package/templates/marketplace/api/cart/[id].ts +51 -0
- package/templates/marketplace/api/cart.ts +70 -0
- package/templates/marketplace/api/categories.ts +11 -0
- package/templates/marketplace/api/checkout.ts +157 -0
- package/templates/marketplace/api/health.ts +7 -0
- package/templates/marketplace/api/listings/[id].ts +101 -0
- package/templates/marketplace/api/listings/paginate.ts +29 -0
- package/templates/marketplace/api/listings.ts +90 -0
- package/templates/marketplace/api/me.ts +14 -0
- package/templates/marketplace/api/orders/[id]/complete.ts +27 -0
- package/templates/marketplace/api/orders/[id]/ship.ts +24 -0
- package/templates/marketplace/api/orders/[id].ts +15 -0
- package/templates/marketplace/api/purchases.ts +19 -0
- package/templates/marketplace/api/reviews.ts +58 -0
- package/templates/marketplace/api/sales.ts +19 -0
- package/templates/marketplace/api/watches/[listingId].ts +18 -0
- package/templates/marketplace/api/watches.ts +51 -0
- package/templates/marketplace/apps/fe/index.html +24 -0
- package/templates/marketplace/apps/fe/openapi-codegen.config.ts +72 -0
- package/templates/marketplace/apps/fe/package.json +84 -0
- package/templates/marketplace/apps/fe/public/apple-touch-icon.png +0 -0
- package/templates/marketplace/apps/fe/public/favicon-96x96.png +0 -0
- package/templates/marketplace/apps/fe/public/favicon.ico +0 -0
- package/templates/marketplace/apps/fe/public/favicon.svg +3 -0
- package/templates/marketplace/apps/fe/public/site.webmanifest +21 -0
- package/templates/marketplace/apps/fe/public/web-app-manifest-192x192.png +0 -0
- package/templates/marketplace/apps/fe/public/web-app-manifest-512x512.png +0 -0
- package/templates/marketplace/apps/fe/src/assets/fonts/GeneralSans-Bold.otf +0 -0
- package/templates/marketplace/apps/fe/src/assets/fonts/GeneralSans-Medium.otf +0 -0
- package/templates/marketplace/apps/fe/src/assets/fonts/GeneralSans-Regular.otf +0 -0
- package/templates/marketplace/apps/fe/src/assets/fonts/GeneralSans-Semibold.otf +0 -0
- package/templates/marketplace/apps/fe/src/assets/locales/en/translation.json +335 -0
- package/templates/marketplace/apps/fe/src/assets/locales/sl/translation.json +335 -0
- package/templates/marketplace/apps/fe/src/clients/app-rest-client.ts +15 -0
- package/templates/marketplace/apps/fe/src/clients/auth-token-store.ts +101 -0
- package/templates/marketplace/apps/fe/src/clients/rest/app-error-handler.ts +31 -0
- package/templates/marketplace/apps/fe/src/clients/rest/interceptors/authorization-header.interceptor.ts +15 -0
- package/templates/marketplace/apps/fe/src/clients/rest/interceptors/refresh-token.interceptor.ts +37 -0
- package/templates/marketplace/apps/fe/src/clients/rest/interceptors/response.interceptor.ts +17 -0
- package/templates/marketplace/apps/fe/src/components/404.tsx +18 -0
- package/templates/marketplace/apps/fe/src/components/features/auth/AuthBrandPanel.tsx +60 -0
- package/templates/marketplace/apps/fe/src/components/features/auth/AuthLayout.tsx +23 -0
- package/templates/marketplace/apps/fe/src/components/features/auth/LoginPage.tsx +111 -0
- package/templates/marketplace/apps/fe/src/components/features/auth/RegisterPage.tsx +143 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/BrowsePage.tsx +76 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/CartPage.tsx +88 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/CheckoutPage.tsx +193 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingCard.tsx +50 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingDetailsPage.tsx +152 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingFormPage.tsx +243 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/MyListingsPage.tsx +84 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/OrdersPage.tsx +224 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/WatchlistPage.tsx +56 -0
- package/templates/marketplace/apps/fe/src/components/features/profile/ProfilePage.tsx +96 -0
- package/templates/marketplace/apps/fe/src/components/googleAnalytics/GoogleAnalytics.tsx +35 -0
- package/templates/marketplace/apps/fe/src/components/layout/AppLayout.tsx +19 -0
- package/templates/marketplace/apps/fe/src/components/layout/app-header/AppHeader.tsx +95 -0
- package/templates/marketplace/apps/fe/src/components/layout/app-header/MobileNavigation.tsx +55 -0
- package/templates/marketplace/apps/fe/src/components/layout/app-header/NavLink.tsx +29 -0
- package/templates/marketplace/apps/fe/src/components/shared/branding/BrandLogo.tsx +13 -0
- package/templates/marketplace/apps/fe/src/components/shared/error/ErrorFallback.tsx +43 -0
- package/templates/marketplace/apps/fe/src/components/shared/error/ErrorText.tsx +20 -0
- package/templates/marketplace/apps/fe/src/components/shared/error/NotFound.tsx +36 -0
- package/templates/marketplace/apps/fe/src/components/shared/forms/RequiredLabel.tsx +21 -0
- package/templates/marketplace/apps/fe/src/components/shared/forms/RowInputWrapper.tsx +50 -0
- package/templates/marketplace/apps/fe/src/components/shared/head/AppHead.tsx +32 -0
- package/templates/marketplace/apps/fe/src/components/shared/head/DefaultAppHead.tsx +34 -0
- package/templates/marketplace/apps/fe/src/components/shared/layout/LoadingState.tsx +9 -0
- package/templates/marketplace/apps/fe/src/components/shared/layout/ThinPageWrapper.tsx +5 -0
- package/templates/marketplace/apps/fe/src/components/shared/page/PageHeader.tsx +69 -0
- package/templates/marketplace/apps/fe/src/components/shared/ui/Card.tsx +60 -0
- package/templates/marketplace/apps/fe/src/components/shared/ui/GoogleLoginButton.tsx +19 -0
- package/templates/marketplace/apps/fe/src/components/shared/ui/RequiredLabel.tsx +22 -0
- package/templates/marketplace/apps/fe/src/components/shared/ui/TableActions.tsx +22 -0
- package/templates/marketplace/apps/fe/src/config/app.config.ts +35 -0
- package/templates/marketplace/apps/fe/src/config/i18n.ts +43 -0
- package/templates/marketplace/apps/fe/src/config/inits/a11y.ts +14 -0
- package/templates/marketplace/apps/fe/src/config/inits/logger.ts +7 -0
- package/templates/marketplace/apps/fe/src/config/inits/sentry.ts +21 -0
- package/templates/marketplace/apps/fe/src/config/jwt.config.ts +2 -0
- package/templates/marketplace/apps/fe/src/config/query.config.ts +20 -0
- package/templates/marketplace/apps/fe/src/hooks/useAuth.ts +5 -0
- package/templates/marketplace/apps/fe/src/main.tsx +52 -0
- package/templates/marketplace/apps/fe/src/pages/(guest)/login.tsx +23 -0
- package/templates/marketplace/apps/fe/src/pages/(guest)/register.tsx +23 -0
- package/templates/marketplace/apps/fe/src/pages/(guest)/route.tsx +18 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/cart.tsx +22 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/checkout.tsx +22 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/index.tsx +22 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/listings/$id/index.tsx +37 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/my-listings.tsx +22 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/orders/$id.tsx +40 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/orders/index.tsx +22 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/profile.tsx +23 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/route.tsx +18 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/sales.tsx +22 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/sell/$id.tsx +44 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/sell/index.tsx +19 -0
- package/templates/marketplace/apps/fe/src/pages/(private)/watchlist.tsx +22 -0
- package/templates/marketplace/apps/fe/src/pages/(public)/auth.tsx +37 -0
- package/templates/marketplace/apps/fe/src/pages/(public)/route.tsx +9 -0
- package/templates/marketplace/apps/fe/src/pages/__root.tsx +164 -0
- package/templates/marketplace/apps/fe/src/providers/AppErrorBoundary.tsx +10 -0
- package/templates/marketplace/apps/fe/src/providers/OpenApiRuntimeProvider.tsx +31 -0
- package/templates/marketplace/apps/fe/src/providers/index.tsx +44 -0
- package/templates/marketplace/apps/fe/src/providers/jwt.provider.tsx +95 -0
- package/templates/marketplace/apps/fe/src/routeTree.gen.ts +435 -0
- package/templates/marketplace/apps/fe/src/styles/base.css +103 -0
- package/templates/marketplace/apps/fe/src/styles/fonts/fonts.tsx +10 -0
- package/templates/marketplace/apps/fe/src/styles/fonts/general-sans.css +31 -0
- package/templates/marketplace/apps/fe/src/styles/globals.css +28 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/defaults/button.override.ts +536 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/defaults/checkbox.override.ts +71 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/defaults/input.override.ts +252 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/defaults/label.override.ts +91 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/defaults/modal.override.ts +57 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/defaults/radio.override.ts +46 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/defaults/table.override.ts +104 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/defaults/tag.override.ts +66 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/defaults/typography.override.ts +115 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/outline.clsx.ts +10 -0
- package/templates/marketplace/apps/fe/src/styles/overrides/uiOverrides.override.ts +60 -0
- package/templates/marketplace/apps/fe/src/styles/theme.css +2177 -0
- package/templates/marketplace/apps/fe/src/types/i18next.d.ts +12 -0
- package/templates/marketplace/apps/fe/src/types/table.d.ts +17 -0
- package/templates/marketplace/apps/fe/src/types/ui.d.ts +26 -0
- package/templates/marketplace/apps/fe/src/types/vite-env.d.ts +20 -0
- package/templates/marketplace/apps/fe/src/utils/date.utils.ts +17 -0
- package/templates/marketplace/apps/fe/src/utils/image-fallback.ts +9 -0
- package/templates/marketplace/apps/fe/src/utils/listing-form.test.ts +69 -0
- package/templates/marketplace/apps/fe/src/utils/listing-form.ts +77 -0
- package/templates/marketplace/apps/fe/src/utils/listing-submit.ts +29 -0
- package/templates/marketplace/apps/fe/src/utils/number.utils.ts +12 -0
- package/templates/marketplace/apps/fe/src/utils/string.utils.ts +5 -0
- package/templates/marketplace/apps/fe/src/vite-env.d.ts +1 -0
- package/templates/marketplace/apps/fe/tsconfig.app.json +32 -0
- package/templates/marketplace/apps/fe/tsconfig.json +9 -0
- package/templates/marketplace/apps/fe/tsconfig.node.json +31 -0
- package/templates/marketplace/apps/fe/vite.config.ts +125 -0
- package/templates/marketplace/database.ts +154 -0
- package/templates/marketplace/openapi.json +2303 -0
- package/templates/marketplace/oxfmt.config.js +23 -0
- package/templates/marketplace/package.json +18 -0
- package/templates/marketplace/rulesync.jsonc +18 -0
- package/templates/marketplace/tsconfig.json +11 -0
- package/templates/space/api/_lib.ts +9 -2
- package/templates/space/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Typography } from "@povio/ui";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
error?: string;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
isHidden?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ErrorText = ({ error, isDisabled, isHidden, className }: Props) => {
|
|
12
|
+
return (
|
|
13
|
+
<Typography
|
|
14
|
+
className={clsx("text-text-error-1", !error || isDisabled || isHidden ? "sr-only" : "mt-1-5", className)}
|
|
15
|
+
size="label-3"
|
|
16
|
+
>
|
|
17
|
+
{error}
|
|
18
|
+
</Typography>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Button, Typography } from "@povio/ui";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { ThinPageWrapper } from "@/components/shared/layout/ThinPageWrapper";
|
|
5
|
+
|
|
6
|
+
export const NotFound = () => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<ThinPageWrapper>
|
|
11
|
+
<div className="flex flex-col items-center justify-center gap-2 p-8 text-center">
|
|
12
|
+
<Typography
|
|
13
|
+
size="title-1"
|
|
14
|
+
variant="prominent-1"
|
|
15
|
+
as="h2"
|
|
16
|
+
>
|
|
17
|
+
{t(($) => $.shared.notFound.heading)}
|
|
18
|
+
</Typography>
|
|
19
|
+
|
|
20
|
+
<Typography
|
|
21
|
+
size="body-2"
|
|
22
|
+
className="text-center text-text-error-1"
|
|
23
|
+
>
|
|
24
|
+
{t(($) => $.shared.notFound.subheading)}
|
|
25
|
+
</Typography>
|
|
26
|
+
|
|
27
|
+
<Button
|
|
28
|
+
size="s"
|
|
29
|
+
link={{ to: "/" }}
|
|
30
|
+
>
|
|
31
|
+
{t(($) => $.shared.notFound.homeBtn)}
|
|
32
|
+
</Button>
|
|
33
|
+
</div>
|
|
34
|
+
</ThinPageWrapper>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Typography, type TypographyProps } from "@povio/ui";
|
|
2
|
+
|
|
3
|
+
interface RequiredLabelProps extends Omit<TypographyProps, "size" | "variant"> {
|
|
4
|
+
size?: TypographyProps["size"];
|
|
5
|
+
variant?: TypographyProps["variant"];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function RequiredLabel({ variant = "prominent-1", size = "label-1", children, ...props }: RequiredLabelProps) {
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex items-center">
|
|
11
|
+
<Typography
|
|
12
|
+
variant={variant}
|
|
13
|
+
size={size}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
<span className="ml-1 text-text-error-3">*</span>
|
|
18
|
+
</Typography>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Typography, type TypographyProps } from "@povio/ui";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
import { RequiredLabel } from "@/components/shared/forms/RequiredLabel";
|
|
6
|
+
|
|
7
|
+
interface RowInputWrapperProps {
|
|
8
|
+
label: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
isRequired?: boolean;
|
|
11
|
+
labelClassName?: string;
|
|
12
|
+
labelSize?: TypographyProps["size"];
|
|
13
|
+
variant?: TypographyProps["variant"];
|
|
14
|
+
className?: string;
|
|
15
|
+
fieldClassName?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function RowInputWrapper({
|
|
19
|
+
label,
|
|
20
|
+
children,
|
|
21
|
+
isRequired = false,
|
|
22
|
+
labelClassName = "w-[140px] sm:w-[180px]",
|
|
23
|
+
labelSize = "label-2",
|
|
24
|
+
variant = "default",
|
|
25
|
+
className = "flex min-w-0 items-start",
|
|
26
|
+
fieldClassName,
|
|
27
|
+
}: RowInputWrapperProps) {
|
|
28
|
+
return (
|
|
29
|
+
<div className={className}>
|
|
30
|
+
<div className={clsx("flex h-[30px] shrink-0 items-center", labelClassName)}>
|
|
31
|
+
{isRequired ? (
|
|
32
|
+
<RequiredLabel
|
|
33
|
+
size={labelSize}
|
|
34
|
+
variant={variant}
|
|
35
|
+
>
|
|
36
|
+
{label}
|
|
37
|
+
</RequiredLabel>
|
|
38
|
+
) : (
|
|
39
|
+
<Typography
|
|
40
|
+
size={labelSize}
|
|
41
|
+
variant={variant}
|
|
42
|
+
>
|
|
43
|
+
{label}
|
|
44
|
+
</Typography>
|
|
45
|
+
)}
|
|
46
|
+
</div>
|
|
47
|
+
<div className={clsx("min-w-0 flex-1", fieldClassName)}>{children}</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useTranslation } from "react-i18next";
|
|
2
|
+
|
|
3
|
+
interface IProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
omitSuffix?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const AppHead = ({ title: titleProp, description: descriptionProp, omitSuffix }: IProps) => {
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
|
|
12
|
+
const titleParts: string[] = [];
|
|
13
|
+
if (titleProp) {
|
|
14
|
+
titleParts.push(titleProp);
|
|
15
|
+
}
|
|
16
|
+
if (!omitSuffix) {
|
|
17
|
+
titleParts.push(t(($) => $.appName));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const title = titleParts.join(" | ");
|
|
21
|
+
const description = descriptionProp ?? t(($) => $.appDescription);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<title>{title}</title>
|
|
26
|
+
<meta
|
|
27
|
+
name="description"
|
|
28
|
+
content={description}
|
|
29
|
+
/>
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useTranslation } from "react-i18next";
|
|
2
|
+
|
|
3
|
+
export const DefaultAppHead = () => {
|
|
4
|
+
const { t } = useTranslation();
|
|
5
|
+
|
|
6
|
+
const title = t(($) => $.appName);
|
|
7
|
+
const description = t(($) => $.appDescription);
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<title>{title}</title>
|
|
12
|
+
<meta
|
|
13
|
+
name="description"
|
|
14
|
+
content={description}
|
|
15
|
+
/>
|
|
16
|
+
<meta
|
|
17
|
+
property="og:title"
|
|
18
|
+
content={title}
|
|
19
|
+
/>
|
|
20
|
+
<meta
|
|
21
|
+
property="og:description"
|
|
22
|
+
content={description}
|
|
23
|
+
/>
|
|
24
|
+
<meta
|
|
25
|
+
name="twitter:title"
|
|
26
|
+
content={title}
|
|
27
|
+
/>
|
|
28
|
+
<meta
|
|
29
|
+
name="twitter:description"
|
|
30
|
+
content={description}
|
|
31
|
+
/>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { InlineIconButton, Typography } from "@povio/ui";
|
|
2
|
+
import { type LinkProps, useRouter } from "@tanstack/react-router";
|
|
3
|
+
import { ChevronLeft } from "lucide-react";
|
|
4
|
+
import type { ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
type PageHeaderBackProps =
|
|
7
|
+
| {
|
|
8
|
+
backLink: LinkProps;
|
|
9
|
+
onBack?: never;
|
|
10
|
+
}
|
|
11
|
+
| {
|
|
12
|
+
backLink?: never;
|
|
13
|
+
onBack: () => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
interface PageHeaderProps {
|
|
17
|
+
title: ReactNode;
|
|
18
|
+
actions?: ReactNode;
|
|
19
|
+
enableBack?: boolean;
|
|
20
|
+
backProps?: PageHeaderBackProps;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function PageHeader({ title, actions, enableBack = false, backProps }: PageHeaderProps) {
|
|
24
|
+
const router = useRouter();
|
|
25
|
+
|
|
26
|
+
const handleBack = () => {
|
|
27
|
+
if (backProps?.onBack) {
|
|
28
|
+
backProps.onBack();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (window.history.length > 1) {
|
|
33
|
+
router.history.back();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (backProps?.backLink) {
|
|
38
|
+
router.navigate(backProps.backLink);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="flex flex-col gap-4">
|
|
44
|
+
<div className="flex items-center justify-between gap-4">
|
|
45
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
46
|
+
{enableBack && (
|
|
47
|
+
<InlineIconButton
|
|
48
|
+
label="Back"
|
|
49
|
+
icon={ChevronLeft}
|
|
50
|
+
color="secondary"
|
|
51
|
+
onPress={handleBack}
|
|
52
|
+
/>
|
|
53
|
+
)}
|
|
54
|
+
|
|
55
|
+
<Typography
|
|
56
|
+
as="h1"
|
|
57
|
+
size="title-4"
|
|
58
|
+
variant="prominent-1"
|
|
59
|
+
className="min-w-0 text-text-default-1"
|
|
60
|
+
>
|
|
61
|
+
{title}
|
|
62
|
+
</Typography>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
{actions && <div className="flex items-center gap-2">{actions}</div>}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Typography, type TypographyProps } from "@povio/ui";
|
|
2
|
+
import { type VariantProps, cva } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
const cardVariants = cva(
|
|
5
|
+
"flex flex-1 flex-col gap-5 rounded-sm border-elevation-outline-default-1 border-b bg-elevation-fill-default-1 shadow-1",
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
padding: {
|
|
9
|
+
sm: "p-3",
|
|
10
|
+
md: "p-4",
|
|
11
|
+
lg: "p-5",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
padding: "md",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
interface CardVariantProps extends VariantProps<typeof cardVariants>, React.HTMLAttributes<HTMLDivElement> {}
|
|
21
|
+
|
|
22
|
+
export interface CardProps extends CardVariantProps {
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
title?: string;
|
|
25
|
+
titleSize?: TypographyProps["size"];
|
|
26
|
+
titleVariant?: TypographyProps["variant"];
|
|
27
|
+
isDisabled?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function Card({
|
|
31
|
+
children,
|
|
32
|
+
className,
|
|
33
|
+
padding,
|
|
34
|
+
title,
|
|
35
|
+
titleSize = "title-5",
|
|
36
|
+
titleVariant = "prominent-1",
|
|
37
|
+
isDisabled = false,
|
|
38
|
+
...props
|
|
39
|
+
}: CardProps) {
|
|
40
|
+
return (
|
|
41
|
+
<div
|
|
42
|
+
className={cardVariants({
|
|
43
|
+
padding,
|
|
44
|
+
className: [className, isDisabled && "pointer-events-none opacity-50"],
|
|
45
|
+
})}
|
|
46
|
+
>
|
|
47
|
+
{title && (
|
|
48
|
+
<Typography
|
|
49
|
+
size={titleSize}
|
|
50
|
+
variant={titleVariant}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
{title}
|
|
54
|
+
</Typography>
|
|
55
|
+
)}
|
|
56
|
+
|
|
57
|
+
{children}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Button } from "@povio/ui";
|
|
2
|
+
|
|
3
|
+
import { AppConfig } from "@/config/app.config";
|
|
4
|
+
|
|
5
|
+
export function GoogleLoginButton() {
|
|
6
|
+
const handleGoogleLogin = () => {
|
|
7
|
+
window.location.href = AppConfig.auth.googleRedirectUrl;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Button
|
|
12
|
+
size="s"
|
|
13
|
+
width="hug"
|
|
14
|
+
onPress={handleGoogleLogin}
|
|
15
|
+
>
|
|
16
|
+
Continue with Google
|
|
17
|
+
</Button>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Typography, type TypographyProps } from "@povio/ui";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
|
|
4
|
+
interface RequiredLabelProps extends Omit<TypographyProps, "variant" | "size"> {
|
|
5
|
+
variant?: ComponentProps<typeof Typography>["variant"];
|
|
6
|
+
size?: ComponentProps<typeof Typography>["size"];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function RequiredLabel({ variant = "prominent-1", size = "label-1", children, ...props }: RequiredLabelProps) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex items-center">
|
|
12
|
+
<Typography
|
|
13
|
+
variant={variant}
|
|
14
|
+
size={size}
|
|
15
|
+
{...props}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
<span className="text-text-error-3">*</span>
|
|
19
|
+
</Typography>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import type { HTMLAttributes } from "react";
|
|
3
|
+
|
|
4
|
+
export function TableActions({ children, className, onClick, onKeyDown, ...props }: HTMLAttributes<HTMLDivElement>) {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
{...props}
|
|
8
|
+
role="presentation"
|
|
9
|
+
className={clsx("flex items-center justify-end gap-1", className)}
|
|
10
|
+
onClick={(event) => {
|
|
11
|
+
event.stopPropagation();
|
|
12
|
+
onClick?.(event);
|
|
13
|
+
}}
|
|
14
|
+
onKeyDown={(event) => {
|
|
15
|
+
event.stopPropagation();
|
|
16
|
+
onKeyDown?.(event);
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
{children}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const authCustomJWT = {
|
|
2
|
+
enableMagicLink: import.meta.env.VITE_PUBLIC_AUTH_CUSTOM_JWT_ENABLE_MAGIC_LINK === "true",
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
const rawApiUrl = import.meta.env.VITE_PUBLIC_API_URL?.trim() ?? "";
|
|
6
|
+
const apiOrigin = /^https?:\/\//i.test(rawApiUrl) ? rawApiUrl.replace(/\/+$/, "") : "";
|
|
7
|
+
const apiMode = import.meta.env.VITE_PUBLIC_API_MODE ?? "real";
|
|
8
|
+
export const AppConfig = {
|
|
9
|
+
isProduction: import.meta.env.NODE_ENV === "production",
|
|
10
|
+
enableWebVitals: import.meta.env.VITE_PUBLIC_ENABLE_WEB_VITALS === "true",
|
|
11
|
+
release: import.meta.env.VITE_PUBLIC_RELEASE,
|
|
12
|
+
stage: import.meta.env.VITE_PUBLIC_STAGE,
|
|
13
|
+
api: {
|
|
14
|
+
url: apiOrigin,
|
|
15
|
+
mode: apiMode,
|
|
16
|
+
},
|
|
17
|
+
log: {
|
|
18
|
+
level: import.meta.env.VITE_PUBLIC_LOG_LEVEL ?? "error",
|
|
19
|
+
},
|
|
20
|
+
sentry: {
|
|
21
|
+
enabled: import.meta.env.VITE_PUBLIC_SENTRY_DSN ? true : false,
|
|
22
|
+
dsn: import.meta.env.VITE_PUBLIC_SENTRY_DSN,
|
|
23
|
+
environment: import.meta.env.VITE_PUBLIC_SENTRY_ENVIRONMENT,
|
|
24
|
+
tracesSampleRate: parseFloat(import.meta.env.VITE_PUBLIC_SENTRY_TRACES_SAMPLE_RATE ?? "0"),
|
|
25
|
+
replaysSessionSampleRate: parseFloat(import.meta.env.VITE_PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE ?? "0"),
|
|
26
|
+
replaysOnErrorSampleRate: parseFloat(import.meta.env.VITE_PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE ?? "0"),
|
|
27
|
+
},
|
|
28
|
+
auth: {
|
|
29
|
+
customJWT: authCustomJWT,
|
|
30
|
+
googleRedirectUrl: `${apiOrigin}/api/user/auth/google`,
|
|
31
|
+
},
|
|
32
|
+
googleAnalytics: {
|
|
33
|
+
measurementId: import.meta.env.VITE_PUBLIC_GOOGLE_ANALYTICS_MEASUREMENT_ID,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { resources as uiResources } from "@povio/ui";
|
|
2
|
+
import {
|
|
3
|
+
configureTranslations as configureOpenApiTranslations,
|
|
4
|
+
resources as openApiResources,
|
|
5
|
+
} from "@povio/openapi-codegen-cli";
|
|
6
|
+
import i18n from "i18next";
|
|
7
|
+
import { initReactI18next } from "react-i18next";
|
|
8
|
+
|
|
9
|
+
import translationEN from "@/assets/locales/en/translation.json";
|
|
10
|
+
import translationSL from "@/assets/locales/sl/translation.json";
|
|
11
|
+
|
|
12
|
+
export const defaultLanguage = "en";
|
|
13
|
+
export const defaultNS = "main";
|
|
14
|
+
export const resources = {
|
|
15
|
+
en: {
|
|
16
|
+
...openApiResources.en,
|
|
17
|
+
...uiResources.en,
|
|
18
|
+
[defaultNS]: translationEN,
|
|
19
|
+
},
|
|
20
|
+
sl: {
|
|
21
|
+
...openApiResources.sl,
|
|
22
|
+
...uiResources.sl,
|
|
23
|
+
[defaultNS]: translationSL,
|
|
24
|
+
},
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
i18n.use(initReactI18next).init({
|
|
28
|
+
compatibilityJSON: "v4",
|
|
29
|
+
fallbackLng: defaultLanguage,
|
|
30
|
+
resources,
|
|
31
|
+
ns: Object.keys(resources.en),
|
|
32
|
+
defaultNS,
|
|
33
|
+
lng: defaultLanguage,
|
|
34
|
+
returnNull: false,
|
|
35
|
+
interpolation: {
|
|
36
|
+
escapeValue: false,
|
|
37
|
+
},
|
|
38
|
+
react: {
|
|
39
|
+
useSuspense: false,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
configureOpenApiTranslations(() => i18n.t);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { AppConfig } from "@/config/app.config";
|
|
4
|
+
|
|
5
|
+
export async function initA11y() {
|
|
6
|
+
if (typeof window !== "undefined" && !AppConfig.isProduction) {
|
|
7
|
+
const ReactDOM = await import("react-dom");
|
|
8
|
+
|
|
9
|
+
// oxlint-disable-next-line import/no-extraneous-dependencies
|
|
10
|
+
const axe = await import("@axe-core/react");
|
|
11
|
+
|
|
12
|
+
axe.default(React, ReactDOM, 1000);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// oxlint-disable-next-line import/no-namespace
|
|
2
|
+
import * as Sentry from "@sentry/react";
|
|
3
|
+
|
|
4
|
+
import { AppConfig } from "@/config/app.config";
|
|
5
|
+
|
|
6
|
+
export function initSentry() {
|
|
7
|
+
Sentry.init({
|
|
8
|
+
enabled: AppConfig.sentry.enabled,
|
|
9
|
+
dsn: AppConfig.sentry.dsn,
|
|
10
|
+
release: AppConfig.release,
|
|
11
|
+
integrations: [
|
|
12
|
+
...(AppConfig.sentry.tracesSampleRate > 0 ? [] : []),
|
|
13
|
+
...(AppConfig.sentry.replaysOnErrorSampleRate > 0 ? [Sentry.replayIntegration()] : []),
|
|
14
|
+
],
|
|
15
|
+
|
|
16
|
+
tracesSampleRate: AppConfig.sentry.tracesSampleRate,
|
|
17
|
+
|
|
18
|
+
replaysSessionSampleRate: AppConfig.sentry.replaysSessionSampleRate,
|
|
19
|
+
replaysOnErrorSampleRate: AppConfig.sentry.replaysOnErrorSampleRate,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ApplicationException, GeneralErrorCodes } from "@povio/openapi-codegen-cli";
|
|
2
|
+
import { QueryClient, type QueryClientConfig } from "@tanstack/react-query";
|
|
3
|
+
|
|
4
|
+
export const QueryConfig: QueryClientConfig = {
|
|
5
|
+
defaultOptions: {
|
|
6
|
+
queries: {
|
|
7
|
+
retry: false,
|
|
8
|
+
refetchOnWindowFocus: false,
|
|
9
|
+
staleTime: 2 * 60 * 1000,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const queryClient = new QueryClient(QueryConfig);
|
|
15
|
+
|
|
16
|
+
declare module "@tanstack/react-query" {
|
|
17
|
+
interface Register {
|
|
18
|
+
defaultError: ApplicationException<GeneralErrorCodes> | null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AbilityContext } from "@povio/openapi-codegen-cli/acl";
|
|
2
|
+
import { LinkContext, type LinkNavigationProps } from "@povio/ui";
|
|
3
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
4
|
+
import { RouterProvider, createLink, createRouter } from "@tanstack/react-router";
|
|
5
|
+
import { type ComponentType, StrictMode } from "react";
|
|
6
|
+
import { Link as AriaLink } from "react-aria-components";
|
|
7
|
+
import { createRoot } from "react-dom/client";
|
|
8
|
+
|
|
9
|
+
import { queryClient } from "@/config/query.config";
|
|
10
|
+
import Providers from "@/providers";
|
|
11
|
+
import { JWTProvider } from "@/providers/jwt.provider";
|
|
12
|
+
import "@/styles/globals.css";
|
|
13
|
+
|
|
14
|
+
import { routeTree } from "./routeTree.gen";
|
|
15
|
+
|
|
16
|
+
const LinkComponent = createLink(AriaLink) as unknown as ComponentType<LinkNavigationProps>;
|
|
17
|
+
|
|
18
|
+
const router = createRouter({
|
|
19
|
+
routeTree,
|
|
20
|
+
defaultPreload: "intent",
|
|
21
|
+
scrollRestoration: true,
|
|
22
|
+
defaultStructuralSharing: true,
|
|
23
|
+
defaultPreloadStaleTime: 0,
|
|
24
|
+
// basepath: import.meta.env.BASE_URL, // Uncomment in monorepo
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
declare module "@tanstack/react-router" {
|
|
28
|
+
interface Register {
|
|
29
|
+
router: typeof router;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const rootElement = document.getElementById("app");
|
|
34
|
+
|
|
35
|
+
if (rootElement && !rootElement.innerHTML) {
|
|
36
|
+
const root = createRoot(rootElement);
|
|
37
|
+
|
|
38
|
+
root.render(
|
|
39
|
+
<StrictMode>
|
|
40
|
+
<Providers
|
|
41
|
+
providers={[
|
|
42
|
+
{ provider: LinkContext.LinkContextProvider, props: { LinkComponent } },
|
|
43
|
+
{ provider: QueryClientProvider, props: { client: queryClient } },
|
|
44
|
+
{ provider: JWTProvider },
|
|
45
|
+
{ provider: AbilityContext.Provider },
|
|
46
|
+
]}
|
|
47
|
+
>
|
|
48
|
+
<RouterProvider router={router} />
|
|
49
|
+
</Providers>
|
|
50
|
+
</StrictMode>,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { LoginPage } from "@/components/features/auth/LoginPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
|
|
7
|
+
function PageComponent() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<AppHead
|
|
13
|
+
title={t(($) => $.auth.login.head.title)}
|
|
14
|
+
description={t(($) => $.auth.login.head.description)}
|
|
15
|
+
/>
|
|
16
|
+
<LoginPage />
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Route = createFileRoute("/(guest)/login")({
|
|
22
|
+
component: PageComponent,
|
|
23
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { RegisterPage } from "@/components/features/auth/RegisterPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
|
|
7
|
+
function PageComponent() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<AppHead
|
|
13
|
+
title={t(($) => $.auth.register.head.title)}
|
|
14
|
+
description={t(($) => $.auth.register.head.description)}
|
|
15
|
+
/>
|
|
16
|
+
<RegisterPage />
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Route = createFileRoute("/(guest)/register")({
|
|
22
|
+
component: PageComponent,
|
|
23
|
+
});
|