robodev 0.23.0 → 0.25.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/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.seed.test.ts +10 -0
- package/templates/marketplace/api/_lib.ts +734 -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 +336 -0
- package/templates/marketplace/apps/fe/src/assets/locales/sl/translation.json +336 -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 +194 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingForm.tsx +278 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingFormPage.tsx +27 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingGallery.tsx +54 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/MyListingsPage.tsx +137 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/OrderStatusTag.tsx +24 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/OrderSummaryCard.tsx +39 -0
- package/templates/marketplace/apps/fe/src/components/features/marketplace/OrdersPage.tsx +236 -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 +32 -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 +15 -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/package.json +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Alert, Button, PasswordInput, TextButton, TextInput, Typography, useForm } from "@povio/ui/tanstack";
|
|
2
|
+
import { useNavigate } from "@tanstack/react-router";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
|
|
6
|
+
import { useAuth } from "@/hooks/useAuth";
|
|
7
|
+
import { UserAuthModels } from "@/openapi/userAuth/userAuth.models";
|
|
8
|
+
import { UserAuthQueries } from "@/openapi/userAuth/userAuth.queries";
|
|
9
|
+
|
|
10
|
+
export function LoginPage() {
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const { updateTokens, userPromise } = useAuth();
|
|
14
|
+
|
|
15
|
+
const [error, setError] = useState<string | null>(null);
|
|
16
|
+
|
|
17
|
+
const loginMutation = UserAuthQueries.useUserAuthLocalPasswordLogin();
|
|
18
|
+
|
|
19
|
+
const form = useForm({
|
|
20
|
+
zodSchema: UserAuthModels.UserAuthPasswordLoginRequestSchema,
|
|
21
|
+
defaultValues: {
|
|
22
|
+
email: "",
|
|
23
|
+
password: "",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const completeLogin = async (tokens: UserAuthModels.AuthnTokenResponse) => {
|
|
28
|
+
updateTokens?.(tokens.accessToken, tokens.refreshToken);
|
|
29
|
+
const user = await userPromise?.();
|
|
30
|
+
if (user === null) {
|
|
31
|
+
throw new Error(t(($) => $.auth.login.form.loginFailed));
|
|
32
|
+
}
|
|
33
|
+
await navigate({ to: "/" });
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const onSubmit = async (data: UserAuthModels.UserAuthPasswordLoginRequest) => {
|
|
37
|
+
setError(null);
|
|
38
|
+
try {
|
|
39
|
+
const tokens = await loginMutation.mutateAsync({ data });
|
|
40
|
+
await completeLogin(tokens);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
setError(error instanceof Error ? error.message : t(($) => $.auth.login.form.loginFailed));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className="flex flex-col gap-8">
|
|
48
|
+
<div className="flex flex-col gap-3">
|
|
49
|
+
<Typography
|
|
50
|
+
variant="prominent-1"
|
|
51
|
+
size="title-2"
|
|
52
|
+
as="h2"
|
|
53
|
+
className="text-text-default-1"
|
|
54
|
+
>
|
|
55
|
+
{t(($) => $.auth.login.form.title)}
|
|
56
|
+
</Typography>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
{error && (
|
|
60
|
+
<Alert
|
|
61
|
+
color="error"
|
|
62
|
+
text={error}
|
|
63
|
+
/>
|
|
64
|
+
)}
|
|
65
|
+
|
|
66
|
+
<form
|
|
67
|
+
onSubmit={form.handleSubmit(onSubmit)}
|
|
68
|
+
className="flex flex-col gap-8"
|
|
69
|
+
>
|
|
70
|
+
<div className="flex flex-col gap-4">
|
|
71
|
+
<TextInput
|
|
72
|
+
field={{ form, name: "email" }}
|
|
73
|
+
label={t(($) => $.auth.login.form.email)}
|
|
74
|
+
placeholder={t(($) => $.auth.login.form.emailPlaceholder)}
|
|
75
|
+
size="default"
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<PasswordInput
|
|
79
|
+
field={{ form, name: "password" }}
|
|
80
|
+
label={t(($) => $.auth.login.form.password)}
|
|
81
|
+
placeholder={t(($) => $.auth.login.form.passwordPlaceholder)}
|
|
82
|
+
size="default"
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<div className="flex flex-col gap-4">
|
|
87
|
+
<Button
|
|
88
|
+
width="fill"
|
|
89
|
+
type="submit"
|
|
90
|
+
isDisabled={loginMutation.isPending}
|
|
91
|
+
isLoading={loginMutation.isPending}
|
|
92
|
+
>
|
|
93
|
+
{t(($) => $.auth.login.form.submit)}
|
|
94
|
+
</Button>
|
|
95
|
+
|
|
96
|
+
</div>
|
|
97
|
+
</form>
|
|
98
|
+
|
|
99
|
+
<div className="flex justify-center gap-1 border-elevation-outline-default-1 border-t pt-6">
|
|
100
|
+
<Typography
|
|
101
|
+
size="label-2"
|
|
102
|
+
className="text-text-default-2"
|
|
103
|
+
>
|
|
104
|
+
{t(($) => $.auth.login.form.noAccount)}
|
|
105
|
+
</Typography>
|
|
106
|
+
|
|
107
|
+
<TextButton link={{ to: "/register" }}>{t(($) => $.auth.login.form.registerLink)}</TextButton>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Alert, Button, PasswordInput, TextButton, TextInput, Typography, useForm } from "@povio/ui/tanstack";
|
|
2
|
+
import { useNavigate } from "@tanstack/react-router";
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
import { useAuth } from "@/hooks/useAuth";
|
|
8
|
+
import { UserAuthModels } from "@/openapi/userAuth/userAuth.models";
|
|
9
|
+
import { UserAuthQueries } from "@/openapi/userAuth/userAuth.queries";
|
|
10
|
+
|
|
11
|
+
export function RegisterPage() {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const navigate = useNavigate();
|
|
14
|
+
const { updateTokens, userPromise } = useAuth();
|
|
15
|
+
|
|
16
|
+
const [error, setError] = useState<string | null>(null);
|
|
17
|
+
|
|
18
|
+
const registerMutation = UserAuthQueries.useRegister();
|
|
19
|
+
const registerFormSchema = useMemo(
|
|
20
|
+
() =>
|
|
21
|
+
UserAuthModels.UserAuthPasswordRegisterRequestSchema.extend({
|
|
22
|
+
confirmPassword: z.string().min(
|
|
23
|
+
1,
|
|
24
|
+
t(($) => $.auth.register.form.confirmPasswordRequired),
|
|
25
|
+
),
|
|
26
|
+
}).refine((data) => data.password === data.confirmPassword, {
|
|
27
|
+
path: ["confirmPassword"],
|
|
28
|
+
message: t(($) => $.auth.register.form.passwordsDoNotMatch),
|
|
29
|
+
}),
|
|
30
|
+
[t],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const form = useForm({
|
|
34
|
+
zodSchema: registerFormSchema,
|
|
35
|
+
defaultValues: {
|
|
36
|
+
email: "",
|
|
37
|
+
name: "",
|
|
38
|
+
password: "",
|
|
39
|
+
confirmPassword: "",
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const onSubmit = async (formData: z.infer<typeof registerFormSchema>) => {
|
|
44
|
+
setError(null);
|
|
45
|
+
const data: UserAuthModels.UserAuthPasswordRegisterRequest = {
|
|
46
|
+
email: formData.email,
|
|
47
|
+
name: formData.name,
|
|
48
|
+
password: formData.password,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const tokens = await registerMutation.mutateAsync({ data });
|
|
53
|
+
updateTokens?.(tokens.accessToken, tokens.refreshToken);
|
|
54
|
+
const user = await userPromise?.();
|
|
55
|
+
if (user === null) {
|
|
56
|
+
throw new Error(t(($) => $.auth.register.form.registrationFailed));
|
|
57
|
+
}
|
|
58
|
+
await navigate({ to: "/" });
|
|
59
|
+
} catch (error) {
|
|
60
|
+
setError(error instanceof Error ? error.message : t(($) => $.auth.register.form.registrationFailed));
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div className="flex flex-col gap-8">
|
|
66
|
+
<Typography
|
|
67
|
+
variant="prominent-1"
|
|
68
|
+
size="title-2"
|
|
69
|
+
as="h2"
|
|
70
|
+
className="text-center text-text-default-1"
|
|
71
|
+
>
|
|
72
|
+
{t(($) => $.auth.register.form.title)}
|
|
73
|
+
</Typography>
|
|
74
|
+
|
|
75
|
+
{error && (
|
|
76
|
+
<Alert
|
|
77
|
+
color="error"
|
|
78
|
+
text={error}
|
|
79
|
+
/>
|
|
80
|
+
)}
|
|
81
|
+
|
|
82
|
+
<form
|
|
83
|
+
onSubmit={form.handleSubmit(onSubmit)}
|
|
84
|
+
className="flex flex-col gap-8"
|
|
85
|
+
>
|
|
86
|
+
<div className="flex flex-col gap-4">
|
|
87
|
+
<TextInput
|
|
88
|
+
field={{ form, name: "email" }}
|
|
89
|
+
label={t(($) => $.auth.register.form.email)}
|
|
90
|
+
placeholder={t(($) => $.auth.register.form.emailPlaceholder)}
|
|
91
|
+
/>
|
|
92
|
+
|
|
93
|
+
<TextInput
|
|
94
|
+
field={{ form, name: "name" }}
|
|
95
|
+
label={t(($) => $.auth.register.form.name)}
|
|
96
|
+
placeholder={t(($) => $.auth.register.form.namePlaceholder)}
|
|
97
|
+
/>
|
|
98
|
+
|
|
99
|
+
<PasswordInput
|
|
100
|
+
field={{ form, name: "password" }}
|
|
101
|
+
label={t(($) => $.auth.register.form.password)}
|
|
102
|
+
placeholder={t(($) => $.auth.register.form.passwordPlaceholder)}
|
|
103
|
+
/>
|
|
104
|
+
|
|
105
|
+
<div className="flex flex-col gap-2">
|
|
106
|
+
<PasswordInput
|
|
107
|
+
field={{ form, name: "confirmPassword" }}
|
|
108
|
+
label={t(($) => $.auth.register.form.confirmPassword)}
|
|
109
|
+
placeholder={t(($) => $.auth.register.form.confirmPasswordPlaceholder)}
|
|
110
|
+
/>
|
|
111
|
+
|
|
112
|
+
<Typography
|
|
113
|
+
size="label-2"
|
|
114
|
+
className="text-text-default-2"
|
|
115
|
+
>
|
|
116
|
+
{t(($) => $.auth.register.form.passwordRequirements)}
|
|
117
|
+
</Typography>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<Button
|
|
122
|
+
width="fill"
|
|
123
|
+
type="submit"
|
|
124
|
+
isDisabled={registerMutation.isPending}
|
|
125
|
+
isLoading={registerMutation.isPending}
|
|
126
|
+
>
|
|
127
|
+
{t(($) => $.auth.register.form.submit)}
|
|
128
|
+
</Button>
|
|
129
|
+
</form>
|
|
130
|
+
|
|
131
|
+
<div className="flex justify-center gap-1">
|
|
132
|
+
<Typography
|
|
133
|
+
size="label-2"
|
|
134
|
+
className="text-text-default-2"
|
|
135
|
+
>
|
|
136
|
+
{t(($) => $.auth.register.form.hasAccount)}
|
|
137
|
+
</Typography>
|
|
138
|
+
|
|
139
|
+
<TextButton link={{ to: "/login" }}>{t(($) => $.auth.register.form.loginLink)}</TextButton>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Button, TextInput, Typography } from "@povio/ui/tanstack";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
|
|
5
|
+
import { LoadingState } from "@/components/shared/layout/LoadingState";
|
|
6
|
+
import { PageHeader } from "@/components/shared/page/PageHeader";
|
|
7
|
+
import { CategoryQueries } from "@/openapi/category/category.queries";
|
|
8
|
+
import { ListingQueries } from "@/openapi/listing/listing.queries";
|
|
9
|
+
|
|
10
|
+
import { ListingCard } from "./ListingCard";
|
|
11
|
+
|
|
12
|
+
export function BrowsePage() {
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const [search, setSearch] = useState("");
|
|
15
|
+
const [categoryId, setCategoryId] = useState<string | undefined>();
|
|
16
|
+
const { data: categories } = CategoryQueries.useGetAll();
|
|
17
|
+
const { data, isLoading } = ListingQueries.usePaginate({
|
|
18
|
+
page: 1,
|
|
19
|
+
limit: 20,
|
|
20
|
+
search: search.trim() || undefined,
|
|
21
|
+
categoryId,
|
|
22
|
+
});
|
|
23
|
+
const listings = data?.items ?? [];
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className="flex flex-col gap-6">
|
|
27
|
+
<PageHeader title={t(($) => $.browse.title)} />
|
|
28
|
+
|
|
29
|
+
<div className="flex flex-col gap-3">
|
|
30
|
+
<TextInput
|
|
31
|
+
variant="filled"
|
|
32
|
+
size="extra-small"
|
|
33
|
+
value={search}
|
|
34
|
+
onChange={setSearch}
|
|
35
|
+
label={t(($) => $.browse.search)}
|
|
36
|
+
placeholder={t(($) => $.browse.searchPlaceholder)}
|
|
37
|
+
/>
|
|
38
|
+
<div className="flex flex-wrap gap-1">
|
|
39
|
+
<Button
|
|
40
|
+
size="xs"
|
|
41
|
+
variant={categoryId ? "outlined" : "contained"}
|
|
42
|
+
color={categoryId ? "secondary" : "primary"}
|
|
43
|
+
onPress={() => setCategoryId(undefined)}
|
|
44
|
+
>
|
|
45
|
+
{t(($) => $.browse.allCategories)}
|
|
46
|
+
</Button>
|
|
47
|
+
{(categories ?? []).map((category) => (
|
|
48
|
+
<Button
|
|
49
|
+
key={category.id}
|
|
50
|
+
size="xs"
|
|
51
|
+
variant={categoryId === category.id ? "contained" : "outlined"}
|
|
52
|
+
color={categoryId === category.id ? "primary" : "secondary"}
|
|
53
|
+
onPress={() => setCategoryId(category.id)}
|
|
54
|
+
>
|
|
55
|
+
{category.name}
|
|
56
|
+
</Button>
|
|
57
|
+
))}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
{isLoading ? (
|
|
62
|
+
<LoadingState />
|
|
63
|
+
) : listings.length === 0 ? (
|
|
64
|
+
<Typography size="body-3" className="text-text-default-2">
|
|
65
|
+
{t(($) => $.browse.empty)}
|
|
66
|
+
</Typography>
|
|
67
|
+
) : (
|
|
68
|
+
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
|
|
69
|
+
{listings.map((listing) => (
|
|
70
|
+
<ListingCard key={listing.id} listing={listing} />
|
|
71
|
+
))}
|
|
72
|
+
</div>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Button, TextInput, Typography, useToast } from "@povio/ui/tanstack";
|
|
2
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
|
|
5
|
+
import { LoadingState } from "@/components/shared/layout/LoadingState";
|
|
6
|
+
import { PageHeader } from "@/components/shared/page/PageHeader";
|
|
7
|
+
import { CartQueries } from "@/openapi/cart/cart.queries";
|
|
8
|
+
import { formatCents } from "@/utils/listing-form";
|
|
9
|
+
|
|
10
|
+
export function CartPage() {
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
const queryClient = useQueryClient();
|
|
13
|
+
const { errorToast } = useToast();
|
|
14
|
+
const { data, isLoading } = CartQueries.useGetAll();
|
|
15
|
+
const updateItem = CartQueries.useUpdate();
|
|
16
|
+
const removeItem = CartQueries.useDeleteApiCartById();
|
|
17
|
+
const items = data ?? [];
|
|
18
|
+
|
|
19
|
+
const onQty = async (id: string, quantity: number) => {
|
|
20
|
+
try {
|
|
21
|
+
await updateItem.mutateAsync({ id, data: { quantity } });
|
|
22
|
+
await queryClient.invalidateQueries({ queryKey: CartQueries.keys.all });
|
|
23
|
+
} catch {
|
|
24
|
+
errorToast({ text: t(($) => $.cart.updateError) });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const onRemove = async (id: string) => {
|
|
29
|
+
try {
|
|
30
|
+
await removeItem.mutateAsync({ id });
|
|
31
|
+
await queryClient.invalidateQueries({ queryKey: CartQueries.keys.all });
|
|
32
|
+
} catch {
|
|
33
|
+
errorToast({ text: t(($) => $.cart.removeError) });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className="flex flex-col gap-6">
|
|
39
|
+
<PageHeader
|
|
40
|
+
title={t(($) => $.cart.title)}
|
|
41
|
+
actions={
|
|
42
|
+
items.length > 0 ? (
|
|
43
|
+
<Button size="xs" link={{ to: "/checkout" }}>
|
|
44
|
+
{t(($) => $.cart.checkout)}
|
|
45
|
+
</Button>
|
|
46
|
+
) : null
|
|
47
|
+
}
|
|
48
|
+
/>
|
|
49
|
+
|
|
50
|
+
{isLoading ? (
|
|
51
|
+
<LoadingState />
|
|
52
|
+
) : items.length === 0 ? (
|
|
53
|
+
<Typography size="body-3" className="text-text-default-2">
|
|
54
|
+
{t(($) => $.cart.empty)}
|
|
55
|
+
</Typography>
|
|
56
|
+
) : (
|
|
57
|
+
<div className="flex flex-col gap-4">
|
|
58
|
+
{items.map((item) => (
|
|
59
|
+
<div
|
|
60
|
+
key={item.id}
|
|
61
|
+
className="flex flex-col gap-2 border-elevation-outline-default-1 border-b pb-4"
|
|
62
|
+
>
|
|
63
|
+
<Typography size="title-5">{item.listing.title}</Typography>
|
|
64
|
+
<Typography size="body-3">{formatCents(item.listing.priceCents)}</Typography>
|
|
65
|
+
<div className="flex flex-wrap items-end gap-2">
|
|
66
|
+
<TextInput
|
|
67
|
+
variant="filled"
|
|
68
|
+
size="extra-small"
|
|
69
|
+
value={String(item.quantity)}
|
|
70
|
+
onChange={(value) => void onQty(item.id, Number(value) || 1)}
|
|
71
|
+
label={t(($) => $.cart.quantity)}
|
|
72
|
+
/>
|
|
73
|
+
<Button
|
|
74
|
+
size="xs"
|
|
75
|
+
variant="outlined"
|
|
76
|
+
color="secondary"
|
|
77
|
+
onPress={() => void onRemove(item.id)}
|
|
78
|
+
>
|
|
79
|
+
{t(($) => $.cart.remove)}
|
|
80
|
+
</Button>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
))}
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { Button, TextInput, Typography, useForm, useToast } from "@povio/ui/tanstack";
|
|
2
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { useNavigate } from "@tanstack/react-router";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
|
|
7
|
+
import { RowInputWrapper } from "@/components/shared/forms/RowInputWrapper";
|
|
8
|
+
import { LoadingState } from "@/components/shared/layout/LoadingState";
|
|
9
|
+
import { PageHeader } from "@/components/shared/page/PageHeader";
|
|
10
|
+
import { CartQueries } from "@/openapi/cart/cart.queries";
|
|
11
|
+
import { CheckoutModels } from "@/openapi/checkout/checkout.models";
|
|
12
|
+
import { CheckoutQueries } from "@/openapi/checkout/checkout.queries";
|
|
13
|
+
import { PurchaseQueries } from "@/openapi/purchase/purchase.queries";
|
|
14
|
+
|
|
15
|
+
export function CheckoutPage() {
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
const navigate = useNavigate();
|
|
18
|
+
const queryClient = useQueryClient();
|
|
19
|
+
const { successToast, errorToast } = useToast();
|
|
20
|
+
const { data: cart, isLoading } = CartQueries.useGetAll();
|
|
21
|
+
const checkout = CheckoutQueries.useCreate();
|
|
22
|
+
const [cardNumber, setCardNumber] = useState("4242424242424242");
|
|
23
|
+
const [expiry, setExpiry] = useState("12/28");
|
|
24
|
+
const [cvc, setCvc] = useState("123");
|
|
25
|
+
const form = useForm({
|
|
26
|
+
zodSchema: CheckoutModels.CheckoutRequestSchema,
|
|
27
|
+
defaultValues: {
|
|
28
|
+
shippingName: "",
|
|
29
|
+
shippingLine1: "",
|
|
30
|
+
shippingLine2: "",
|
|
31
|
+
shippingCity: "",
|
|
32
|
+
shippingRegion: "",
|
|
33
|
+
shippingPostal: "",
|
|
34
|
+
shippingCountry: "",
|
|
35
|
+
last4: undefined,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const onSubmit = async (data: CheckoutModels.CheckoutRequest) => {
|
|
40
|
+
const last4 = cardNumber.replace(/\D/g, "").slice(-4);
|
|
41
|
+
try {
|
|
42
|
+
await checkout.mutateAsync({
|
|
43
|
+
data: {
|
|
44
|
+
shippingName: data.shippingName,
|
|
45
|
+
shippingLine1: data.shippingLine1,
|
|
46
|
+
shippingLine2: data.shippingLine2,
|
|
47
|
+
shippingCity: data.shippingCity,
|
|
48
|
+
shippingRegion: data.shippingRegion,
|
|
49
|
+
shippingPostal: data.shippingPostal,
|
|
50
|
+
shippingCountry: data.shippingCountry,
|
|
51
|
+
last4: last4 && last4.length === 4 ? last4 : undefined,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
await queryClient.invalidateQueries({ queryKey: CartQueries.keys.all });
|
|
55
|
+
await queryClient.invalidateQueries({ queryKey: PurchaseQueries.keys.all });
|
|
56
|
+
successToast({ text: t(($) => $.checkout.success) });
|
|
57
|
+
await navigate({ to: "/orders" });
|
|
58
|
+
} catch {
|
|
59
|
+
errorToast({ text: t(($) => $.checkout.error) });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
if (isLoading) return <LoadingState />;
|
|
64
|
+
if (!cart || cart.length === 0) {
|
|
65
|
+
return (
|
|
66
|
+
<div className="flex flex-col gap-6">
|
|
67
|
+
<PageHeader title={t(($) => $.checkout.title)} />
|
|
68
|
+
<Typography size="body-3" className="text-text-default-2">
|
|
69
|
+
{t(($) => $.checkout.empty)}
|
|
70
|
+
</Typography>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div className="flex flex-col gap-6">
|
|
77
|
+
<PageHeader title={t(($) => $.checkout.title)} />
|
|
78
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="flex max-w-xl flex-col gap-4">
|
|
79
|
+
<Typography size="title-5" variant="prominent-1">
|
|
80
|
+
{t(($) => $.checkout.shipping)}
|
|
81
|
+
</Typography>
|
|
82
|
+
<RowInputWrapper label={t(($) => $.checkout.name)} isRequired>
|
|
83
|
+
<TextInput
|
|
84
|
+
variant="filled"
|
|
85
|
+
size="extra-small"
|
|
86
|
+
field={{ form, name: "shippingName" }}
|
|
87
|
+
label={t(($) => $.checkout.name)}
|
|
88
|
+
hideLabel
|
|
89
|
+
isRequired
|
|
90
|
+
/>
|
|
91
|
+
</RowInputWrapper>
|
|
92
|
+
<RowInputWrapper label={t(($) => $.checkout.line1)} isRequired>
|
|
93
|
+
<TextInput
|
|
94
|
+
variant="filled"
|
|
95
|
+
size="extra-small"
|
|
96
|
+
field={{ form, name: "shippingLine1" }}
|
|
97
|
+
label={t(($) => $.checkout.line1)}
|
|
98
|
+
hideLabel
|
|
99
|
+
isRequired
|
|
100
|
+
/>
|
|
101
|
+
</RowInputWrapper>
|
|
102
|
+
<RowInputWrapper label={t(($) => $.checkout.line2)}>
|
|
103
|
+
<TextInput
|
|
104
|
+
variant="filled"
|
|
105
|
+
size="extra-small"
|
|
106
|
+
field={{ form, name: "shippingLine2" }}
|
|
107
|
+
label={t(($) => $.checkout.line2)}
|
|
108
|
+
hideLabel
|
|
109
|
+
/>
|
|
110
|
+
</RowInputWrapper>
|
|
111
|
+
<RowInputWrapper label={t(($) => $.checkout.city)} isRequired>
|
|
112
|
+
<TextInput
|
|
113
|
+
variant="filled"
|
|
114
|
+
size="extra-small"
|
|
115
|
+
field={{ form, name: "shippingCity" }}
|
|
116
|
+
label={t(($) => $.checkout.city)}
|
|
117
|
+
hideLabel
|
|
118
|
+
isRequired
|
|
119
|
+
/>
|
|
120
|
+
</RowInputWrapper>
|
|
121
|
+
<RowInputWrapper label={t(($) => $.checkout.region)}>
|
|
122
|
+
<TextInput
|
|
123
|
+
variant="filled"
|
|
124
|
+
size="extra-small"
|
|
125
|
+
field={{ form, name: "shippingRegion" }}
|
|
126
|
+
label={t(($) => $.checkout.region)}
|
|
127
|
+
hideLabel
|
|
128
|
+
/>
|
|
129
|
+
</RowInputWrapper>
|
|
130
|
+
<RowInputWrapper label={t(($) => $.checkout.postal)} isRequired>
|
|
131
|
+
<TextInput
|
|
132
|
+
variant="filled"
|
|
133
|
+
size="extra-small"
|
|
134
|
+
field={{ form, name: "shippingPostal" }}
|
|
135
|
+
label={t(($) => $.checkout.postal)}
|
|
136
|
+
hideLabel
|
|
137
|
+
isRequired
|
|
138
|
+
/>
|
|
139
|
+
</RowInputWrapper>
|
|
140
|
+
<RowInputWrapper label={t(($) => $.checkout.country)} isRequired>
|
|
141
|
+
<TextInput
|
|
142
|
+
variant="filled"
|
|
143
|
+
size="extra-small"
|
|
144
|
+
field={{ form, name: "shippingCountry" }}
|
|
145
|
+
label={t(($) => $.checkout.country)}
|
|
146
|
+
hideLabel
|
|
147
|
+
isRequired
|
|
148
|
+
/>
|
|
149
|
+
</RowInputWrapper>
|
|
150
|
+
|
|
151
|
+
<Typography size="title-5" variant="prominent-1">
|
|
152
|
+
{t(($) => $.checkout.card)}
|
|
153
|
+
</Typography>
|
|
154
|
+
<RowInputWrapper label={t(($) => $.checkout.cardNumber)}>
|
|
155
|
+
<TextInput
|
|
156
|
+
variant="filled"
|
|
157
|
+
size="extra-small"
|
|
158
|
+
value={cardNumber}
|
|
159
|
+
onChange={setCardNumber}
|
|
160
|
+
label={t(($) => $.checkout.cardNumber)}
|
|
161
|
+
hideLabel
|
|
162
|
+
/>
|
|
163
|
+
</RowInputWrapper>
|
|
164
|
+
<RowInputWrapper label={t(($) => $.checkout.expiry)}>
|
|
165
|
+
<TextInput
|
|
166
|
+
variant="filled"
|
|
167
|
+
size="extra-small"
|
|
168
|
+
value={expiry}
|
|
169
|
+
onChange={setExpiry}
|
|
170
|
+
label={t(($) => $.checkout.expiry)}
|
|
171
|
+
hideLabel
|
|
172
|
+
/>
|
|
173
|
+
</RowInputWrapper>
|
|
174
|
+
<RowInputWrapper label={t(($) => $.checkout.cvc)}>
|
|
175
|
+
<TextInput
|
|
176
|
+
variant="filled"
|
|
177
|
+
size="extra-small"
|
|
178
|
+
value={cvc}
|
|
179
|
+
onChange={setCvc}
|
|
180
|
+
label={t(($) => $.checkout.cvc)}
|
|
181
|
+
hideLabel
|
|
182
|
+
/>
|
|
183
|
+
</RowInputWrapper>
|
|
184
|
+
|
|
185
|
+
<div className="flex justify-end">
|
|
186
|
+
<Button type="submit" size="xs" isLoading={checkout.isPending}>
|
|
187
|
+
{t(($) => $.checkout.submit)}
|
|
188
|
+
</Button>
|
|
189
|
+
</div>
|
|
190
|
+
</form>
|
|
191
|
+
</div>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Link, Typography } from "@povio/ui";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import type { ListingModels } from "@/openapi/listing/listing.models";
|
|
5
|
+
import { getFallbackImageUrl } from "@/utils/image-fallback";
|
|
6
|
+
import { formatCents } from "@/utils/listing-form";
|
|
7
|
+
|
|
8
|
+
interface ListingCardProps {
|
|
9
|
+
listing: ListingModels.ListingDto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function ListingCard({ listing }: ListingCardProps) {
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const imageSrc = listing.images[0]?.url ?? getFallbackImageUrl({ width: 400, height: 300 });
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Link
|
|
18
|
+
to="/listings/$id"
|
|
19
|
+
params={{ id: listing.id }}
|
|
20
|
+
className="relative overflow-hidden rounded-m border border-elevation-outline-default-1 bg-elevation-fill-default-1 no-underline! shadow-sm transition-all hover:border-elevation-outline-default-2 hover:bg-elevation-fill-default-2"
|
|
21
|
+
>
|
|
22
|
+
<div className="aspect-video w-full bg-elevation-fill-default-2">
|
|
23
|
+
<img src={imageSrc} alt="" className="h-full w-full object-cover" />
|
|
24
|
+
</div>
|
|
25
|
+
<div className="flex flex-col gap-2 p-4">
|
|
26
|
+
<Typography
|
|
27
|
+
size="title-5"
|
|
28
|
+
variant="prominent-1"
|
|
29
|
+
as="h3"
|
|
30
|
+
className="min-w-0 text-text-default-1"
|
|
31
|
+
>
|
|
32
|
+
{listing.title}
|
|
33
|
+
</Typography>
|
|
34
|
+
<Typography size="body-3" className="text-text-default-1">
|
|
35
|
+
{formatCents(listing.priceCents)}
|
|
36
|
+
</Typography>
|
|
37
|
+
{listing.quantity <= 0 ? (
|
|
38
|
+
<Typography size="label-3" className="text-text-default-2">
|
|
39
|
+
{t(($) => $.sell.soldOut)}
|
|
40
|
+
</Typography>
|
|
41
|
+
) : null}
|
|
42
|
+
{listing.category ? (
|
|
43
|
+
<Typography size="label-3" className="text-text-default-2">
|
|
44
|
+
{listing.category.name}
|
|
45
|
+
</Typography>
|
|
46
|
+
) : null}
|
|
47
|
+
</div>
|
|
48
|
+
</Link>
|
|
49
|
+
);
|
|
50
|
+
}
|