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,18 @@
|
|
|
1
|
+
import { AuthGuard } from "@povio/openapi-codegen-cli";
|
|
2
|
+
import { Outlet, createFileRoute } from "@tanstack/react-router";
|
|
3
|
+
|
|
4
|
+
import { AuthLayout } from "@/components/features/auth/AuthLayout";
|
|
5
|
+
|
|
6
|
+
function GuestLayout() {
|
|
7
|
+
return (
|
|
8
|
+
<AuthGuard type="public-only">
|
|
9
|
+
<AuthLayout>
|
|
10
|
+
<Outlet />
|
|
11
|
+
</AuthLayout>
|
|
12
|
+
</AuthGuard>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const Route = createFileRoute("/(guest)")({
|
|
17
|
+
component: GuestLayout,
|
|
18
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { CartPage } from "@/components/features/marketplace/CartPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
|
|
7
|
+
function PageComponent() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<AppHead
|
|
12
|
+
title={t(($) => $.cart.head.title)}
|
|
13
|
+
description={t(($) => $.cart.head.description)}
|
|
14
|
+
/>
|
|
15
|
+
<CartPage />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Route = createFileRoute("/(private)/cart")({
|
|
21
|
+
component: PageComponent,
|
|
22
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { CheckoutPage } from "@/components/features/marketplace/CheckoutPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
|
|
7
|
+
function PageComponent() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<AppHead
|
|
12
|
+
title={t(($) => $.checkout.head.title)}
|
|
13
|
+
description={t(($) => $.checkout.head.description)}
|
|
14
|
+
/>
|
|
15
|
+
<CheckoutPage />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Route = createFileRoute("/(private)/checkout")({
|
|
21
|
+
component: PageComponent,
|
|
22
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { BrowsePage } from "@/components/features/marketplace/BrowsePage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
|
|
7
|
+
function PageComponent() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<AppHead
|
|
12
|
+
title={t(($) => $.browse.head.title)}
|
|
13
|
+
description={t(($) => $.browse.head.description)}
|
|
14
|
+
/>
|
|
15
|
+
<BrowsePage />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Route = createFileRoute("/(private)/")({
|
|
21
|
+
component: PageComponent,
|
|
22
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { ListingDetailsPage } from "@/components/features/marketplace/ListingDetailsPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
import { LoadingState } from "@/components/shared/layout/LoadingState";
|
|
7
|
+
import { ListingQueries } from "@/openapi/listing/listing.queries";
|
|
8
|
+
|
|
9
|
+
function PageComponent() {
|
|
10
|
+
const { id } = Route.useParams();
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
const { data: listing, isLoading } = ListingQueries.useGetById({ id }, { enabled: !!id });
|
|
13
|
+
|
|
14
|
+
if (isLoading) return <LoadingState />;
|
|
15
|
+
if (!listing) {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<AppHead title={t(($) => $.browse.head.title)} />
|
|
19
|
+
<p className="text-text-default-2">{t(($) => $.listing.notFound)}</p>
|
|
20
|
+
</>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<AppHead
|
|
27
|
+
title={listing.title}
|
|
28
|
+
description={listing.description ?? undefined}
|
|
29
|
+
/>
|
|
30
|
+
<ListingDetailsPage listing={listing} />
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const Route = createFileRoute("/(private)/listings/$id/")({
|
|
36
|
+
component: PageComponent,
|
|
37
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { MyListingsPage } from "@/components/features/marketplace/MyListingsPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
|
|
7
|
+
function PageComponent() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<AppHead
|
|
12
|
+
title={t(($) => $.sell.head.title)}
|
|
13
|
+
description={t(($) => $.sell.head.description)}
|
|
14
|
+
/>
|
|
15
|
+
<MyListingsPage />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Route = createFileRoute("/(private)/my-listings")({
|
|
21
|
+
component: PageComponent,
|
|
22
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { OrderDetailPage } from "@/components/features/marketplace/OrdersPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
import { LoadingState } from "@/components/shared/layout/LoadingState";
|
|
7
|
+
import { useAuth } from "@/hooks/useAuth";
|
|
8
|
+
import { OrderQueries } from "@/openapi/order/order.queries";
|
|
9
|
+
|
|
10
|
+
function PageComponent() {
|
|
11
|
+
const { id } = Route.useParams();
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const { user } = useAuth();
|
|
14
|
+
const { data: order, isLoading } = OrderQueries.useGetById({ id }, { enabled: !!id });
|
|
15
|
+
|
|
16
|
+
if (isLoading) return <LoadingState />;
|
|
17
|
+
if (!order) {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<AppHead title={t(($) => $.orders.head.title)} />
|
|
21
|
+
<p className="text-text-default-2">{t(($) => $.orders.notFound)}</p>
|
|
22
|
+
</>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const role = user?.id === order.sellerId ? "seller" : "buyer";
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<AppHead title={t(($) => $.orders.head.title)} />
|
|
30
|
+
<OrderDetailPage
|
|
31
|
+
order={order}
|
|
32
|
+
role={role}
|
|
33
|
+
/>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const Route = createFileRoute("/(private)/orders/$id")({
|
|
39
|
+
component: PageComponent,
|
|
40
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { OrdersPage } from "@/components/features/marketplace/OrdersPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
|
|
7
|
+
function PageComponent() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<AppHead
|
|
12
|
+
title={t(($) => $.orders.head.title)}
|
|
13
|
+
description={t(($) => $.orders.head.description)}
|
|
14
|
+
/>
|
|
15
|
+
<OrdersPage />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Route = createFileRoute("/(private)/orders/")({
|
|
21
|
+
component: PageComponent,
|
|
22
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { ProfilePage } from "@/components/features/profile/ProfilePage";
|
|
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(($) => $.profile.head.title)}
|
|
14
|
+
description={t(($) => $.profile.head.description)}
|
|
15
|
+
/>
|
|
16
|
+
<ProfilePage />
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Route = createFileRoute("/(private)/profile")({
|
|
22
|
+
component: PageComponent,
|
|
23
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AuthGuard } from "@povio/openapi-codegen-cli";
|
|
2
|
+
import { Outlet, createFileRoute } from "@tanstack/react-router";
|
|
3
|
+
|
|
4
|
+
import { AppLayout } from "@/components/layout/AppLayout";
|
|
5
|
+
|
|
6
|
+
function PrivateLayout() {
|
|
7
|
+
return (
|
|
8
|
+
<AuthGuard type="private">
|
|
9
|
+
<AppLayout>
|
|
10
|
+
<Outlet />
|
|
11
|
+
</AppLayout>
|
|
12
|
+
</AuthGuard>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const Route = createFileRoute("/(private)")({
|
|
17
|
+
component: PrivateLayout,
|
|
18
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { OrdersPage } from "@/components/features/marketplace/OrdersPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
|
|
7
|
+
function PageComponent() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<AppHead
|
|
12
|
+
title={t(($) => $.orders.sales)}
|
|
13
|
+
description={t(($) => $.orders.head.description)}
|
|
14
|
+
/>
|
|
15
|
+
<OrdersPage />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Route = createFileRoute("/(private)/sales")({
|
|
21
|
+
component: PageComponent,
|
|
22
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Navigate, createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { ListingFormPage } from "@/components/features/marketplace/ListingFormPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
import { LoadingState } from "@/components/shared/layout/LoadingState";
|
|
7
|
+
import { useAuth } from "@/hooks/useAuth";
|
|
8
|
+
import { ListingQueries } from "@/openapi/listing/listing.queries";
|
|
9
|
+
|
|
10
|
+
function PageComponent() {
|
|
11
|
+
const { id } = Route.useParams();
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const { user } = useAuth();
|
|
14
|
+
const { data: listing, isLoading } = ListingQueries.useGetById({ id }, { enabled: !!id });
|
|
15
|
+
|
|
16
|
+
if (isLoading) return <LoadingState />;
|
|
17
|
+
if (!listing) {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<AppHead title={t(($) => $.listingForm.editTitle)} />
|
|
21
|
+
<p className="text-text-default-2">{t(($) => $.listing.notFound)}</p>
|
|
22
|
+
</>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
if (user?.id !== listing.sellerId) {
|
|
26
|
+
return (
|
|
27
|
+
<Navigate
|
|
28
|
+
to="/listings/$id"
|
|
29
|
+
params={{ id: listing.id }}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<>
|
|
36
|
+
<AppHead title={t(($) => $.listingForm.editTitle)} />
|
|
37
|
+
<ListingFormPage listing={listing} />
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const Route = createFileRoute("/(private)/sell/$id")({
|
|
43
|
+
component: PageComponent,
|
|
44
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { ListingFormPage } from "@/components/features/marketplace/ListingFormPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
|
|
7
|
+
function PageComponent() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<AppHead title={t(($) => $.listingForm.createTitle)} />
|
|
12
|
+
<ListingFormPage />
|
|
13
|
+
</>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Route = createFileRoute("/(private)/sell/")({
|
|
18
|
+
component: PageComponent,
|
|
19
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
4
|
+
import { WatchlistPage } from "@/components/features/marketplace/WatchlistPage";
|
|
5
|
+
import { AppHead } from "@/components/shared/head/AppHead";
|
|
6
|
+
|
|
7
|
+
function PageComponent() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<AppHead
|
|
12
|
+
title={t(($) => $.watchlist.head.title)}
|
|
13
|
+
description={t(($) => $.watchlist.head.description)}
|
|
14
|
+
/>
|
|
15
|
+
<WatchlistPage />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Route = createFileRoute("/(private)/watchlist")({
|
|
21
|
+
component: PageComponent,
|
|
22
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import z from "zod";
|
|
4
|
+
|
|
5
|
+
import { LoadingState } from "@/components/shared/layout/LoadingState";
|
|
6
|
+
import { useAuth } from "@/hooks/useAuth";
|
|
7
|
+
|
|
8
|
+
const authSearchSchema = z.object({
|
|
9
|
+
type: z.string().optional(),
|
|
10
|
+
accessToken: z.string().optional(),
|
|
11
|
+
refreshToken: z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
function AuthCallbackPage() {
|
|
15
|
+
const navigate = useNavigate();
|
|
16
|
+
const { accessToken, refreshToken } = Route.useSearch();
|
|
17
|
+
const { updateTokens } = useAuth();
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (accessToken) {
|
|
21
|
+
const decodedAccessToken = decodeURIComponent(accessToken);
|
|
22
|
+
const decodedRefreshToken = refreshToken ? decodeURIComponent(refreshToken) : undefined;
|
|
23
|
+
updateTokens?.(decodedAccessToken, decodedRefreshToken);
|
|
24
|
+
|
|
25
|
+
navigate({ to: "/" });
|
|
26
|
+
} else {
|
|
27
|
+
navigate({ to: "/login" });
|
|
28
|
+
}
|
|
29
|
+
}, [accessToken, refreshToken, navigate, updateTokens]);
|
|
30
|
+
|
|
31
|
+
return <LoadingState />;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Route = createFileRoute("/(public)/auth")({
|
|
35
|
+
component: AuthCallbackPage,
|
|
36
|
+
validateSearch: authSearchSchema,
|
|
37
|
+
});
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { OpenApiRouter } from "@povio/openapi-codegen-cli";
|
|
2
|
+
import { Confirmation, ToastContainer, UIConfig, UIOverrides, UIRouter } from "@povio/ui";
|
|
3
|
+
import { TanStackDevtools } from "@tanstack/react-devtools";
|
|
4
|
+
import { ReactQueryDevtoolsPanel } from "@tanstack/react-query-devtools";
|
|
5
|
+
import { Outlet, createRootRoute, useNavigate, useRouterState } from "@tanstack/react-router";
|
|
6
|
+
import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools";
|
|
7
|
+
import { useCallback, useEffect } from "react";
|
|
8
|
+
import { useTranslation } from "react-i18next";
|
|
9
|
+
import { onCLS, onINP, onLCP } from "web-vitals";
|
|
10
|
+
|
|
11
|
+
import { NotFoundPage } from "@/components/404";
|
|
12
|
+
import GoogleAnalytics from "@/components/googleAnalytics/GoogleAnalytics";
|
|
13
|
+
import { DefaultAppHead } from "@/components/shared/head/DefaultAppHead";
|
|
14
|
+
import { AppConfig } from "@/config/app.config";
|
|
15
|
+
import { initA11y } from "@/config/inits/a11y";
|
|
16
|
+
import { initLogger } from "@/config/inits/logger";
|
|
17
|
+
import { initSentry } from "@/config/inits/sentry";
|
|
18
|
+
import Providers from "@/providers";
|
|
19
|
+
import { AppErrorBoundary } from "@/providers/AppErrorBoundary";
|
|
20
|
+
import { OpenApiRuntimeProvider } from "@/providers/OpenApiRuntimeProvider";
|
|
21
|
+
import { Fonts } from "@/styles/fonts/fonts";
|
|
22
|
+
import { uiOverrides } from "@/styles/overrides/uiOverrides.override";
|
|
23
|
+
|
|
24
|
+
import "@/config/i18n";
|
|
25
|
+
initLogger();
|
|
26
|
+
initSentry();
|
|
27
|
+
initA11y();
|
|
28
|
+
|
|
29
|
+
const Root = () => {
|
|
30
|
+
const { i18n } = useTranslation();
|
|
31
|
+
|
|
32
|
+
const navigate = useNavigate();
|
|
33
|
+
const searchString = useRouterState({
|
|
34
|
+
select: (state) => state.location.searchStr,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const push = useCallback(
|
|
38
|
+
async (to: string, params?: Record<string, unknown>) => {
|
|
39
|
+
await navigate({ to, search: params });
|
|
40
|
+
return true;
|
|
41
|
+
},
|
|
42
|
+
[navigate],
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const replace = useCallback(
|
|
46
|
+
async (to: string, params?: Record<string, unknown>) => {
|
|
47
|
+
await navigate({ to, replace: true, search: params });
|
|
48
|
+
return true;
|
|
49
|
+
},
|
|
50
|
+
[navigate],
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const handler = (lng: string) => {
|
|
55
|
+
if (typeof document !== "undefined") {
|
|
56
|
+
document.documentElement.setAttribute("lang", lng);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
i18n.on("languageChanged", handler);
|
|
60
|
+
return () => {
|
|
61
|
+
i18n.off("languageChanged", handler);
|
|
62
|
+
};
|
|
63
|
+
}, [i18n]);
|
|
64
|
+
|
|
65
|
+
if (AppConfig.enableWebVitals) {
|
|
66
|
+
onCLS(console.log);
|
|
67
|
+
onINP(console.log);
|
|
68
|
+
onLCP(console.log);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
<GoogleAnalytics />
|
|
74
|
+
<AppErrorBoundary>
|
|
75
|
+
<Providers
|
|
76
|
+
providers={[
|
|
77
|
+
// { provider: ThemeContext.ThemeContextProvider }, // Uncomment for dark theme support
|
|
78
|
+
{ provider: UIRouter.UIRouterProvider, props: { push, replace, searchString } },
|
|
79
|
+
{ provider: OpenApiRouter.Provider, props: { replace } },
|
|
80
|
+
{
|
|
81
|
+
provider: UIConfig.Provider,
|
|
82
|
+
props: {
|
|
83
|
+
config: {
|
|
84
|
+
input: {
|
|
85
|
+
size: "small",
|
|
86
|
+
},
|
|
87
|
+
tableCellText: {
|
|
88
|
+
size: "label-2",
|
|
89
|
+
variant: "default",
|
|
90
|
+
},
|
|
91
|
+
tableHeaderText: {
|
|
92
|
+
size: "label-2",
|
|
93
|
+
variant: "prominent-1",
|
|
94
|
+
},
|
|
95
|
+
tag: {
|
|
96
|
+
textSize: "label-3",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
provider: UIOverrides.Provider,
|
|
103
|
+
props: {
|
|
104
|
+
config: uiOverrides,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{ provider: OpenApiRuntimeProvider },
|
|
108
|
+
{ provider: Confirmation.Provider },
|
|
109
|
+
]}
|
|
110
|
+
>
|
|
111
|
+
<Fonts />
|
|
112
|
+
<DefaultAppHead />
|
|
113
|
+
|
|
114
|
+
<RootLayout />
|
|
115
|
+
|
|
116
|
+
<ToastContainer />
|
|
117
|
+
<TanStackDevtools
|
|
118
|
+
plugins={[
|
|
119
|
+
{
|
|
120
|
+
name: "TanStack Query",
|
|
121
|
+
render: <ReactQueryDevtoolsPanel />,
|
|
122
|
+
defaultOpen: true,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "TanStack Router",
|
|
126
|
+
render: <TanStackRouterDevtoolsPanel />,
|
|
127
|
+
defaultOpen: false,
|
|
128
|
+
},
|
|
129
|
+
]}
|
|
130
|
+
/>
|
|
131
|
+
</Providers>
|
|
132
|
+
</AppErrorBoundary>
|
|
133
|
+
</>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
function RootLayout() {
|
|
138
|
+
return (
|
|
139
|
+
<main className="font-primary">
|
|
140
|
+
<Outlet />
|
|
141
|
+
</main>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const Route = createRootRoute({
|
|
146
|
+
head: () => ({
|
|
147
|
+
meta: [
|
|
148
|
+
{ charSet: "utf8" },
|
|
149
|
+
{ name: "viewport", content: "width=device-width, initial-scale=1" },
|
|
150
|
+
{ name: "theme-color", content: "#ffffff" },
|
|
151
|
+
{ title: "Marketplace" },
|
|
152
|
+
{ name: "msapplication-TileColor", content: "#da532c" },
|
|
153
|
+
],
|
|
154
|
+
links: [
|
|
155
|
+
{ rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" },
|
|
156
|
+
{ rel: "icon", type: "image/png", sizes: "96x96", href: "/favicon-96x96.png" },
|
|
157
|
+
{ rel: "icon", type: "image/svg+xml", href: "/favicon.svg" },
|
|
158
|
+
{ rel: "shortcut icon", href: "/favicon.ico" },
|
|
159
|
+
{ rel: "manifest", href: "/site.webmanifest" },
|
|
160
|
+
],
|
|
161
|
+
}),
|
|
162
|
+
component: Root,
|
|
163
|
+
notFoundComponent: NotFoundPage,
|
|
164
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ErrorBoundary } from "@sentry/react";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
|
|
4
|
+
import { ErrorFallback, type ErrorFallbackProps } from "@/components/shared/error/ErrorFallback";
|
|
5
|
+
|
|
6
|
+
const Fallback = (props: ErrorFallbackProps) => <ErrorFallback {...props} />;
|
|
7
|
+
|
|
8
|
+
export const AppErrorBoundary = ({ children }: PropsWithChildren) => {
|
|
9
|
+
return <ErrorBoundary fallback={Fallback}>{children}</ErrorBoundary>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ErrorHandler, OpenApiQueryConfig } from "@povio/openapi-codegen-cli";
|
|
2
|
+
import { useToast } from "@povio/ui";
|
|
3
|
+
import type { PropsWithChildren } from "react";
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
|
|
7
|
+
export function OpenApiRuntimeProvider({ children }: PropsWithChildren) {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const { errorToast } = useToast();
|
|
10
|
+
|
|
11
|
+
const handleError = useCallback(
|
|
12
|
+
(error: unknown) => {
|
|
13
|
+
console.error(error);
|
|
14
|
+
errorToast({
|
|
15
|
+
text: t(($) => $.shared.apiErrors.requestFailed, {
|
|
16
|
+
error: ErrorHandler.getErrorMessage(error) ?? t(($) => $.shared.apiErrors.unknown),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
[errorToast, t],
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<OpenApiQueryConfig.Provider
|
|
25
|
+
allowInvalidResponseData={import.meta.env.DEV}
|
|
26
|
+
onError={handleError}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</OpenApiQueryConfig.Provider>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ComponentProps, JSX, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
type HasRequiredProperty<T> = {
|
|
4
|
+
[K in keyof T]-?: Record<string, never> extends Pick<T, K> ? never : K;
|
|
5
|
+
}[keyof T];
|
|
6
|
+
|
|
7
|
+
interface ProviderBase<T> {
|
|
8
|
+
provider: T;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface ProviderProps<T extends keyof JSX.IntrinsicElements> {
|
|
12
|
+
props: Omit<ComponentProps<T>, "children">;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// oxlint-disable-next-line no-explicit-any
|
|
16
|
+
type ProvidersArray<T extends any[]> = [
|
|
17
|
+
...{
|
|
18
|
+
[K in keyof T]: HasRequiredProperty<Omit<ComponentProps<T[K]>, "children">> extends never
|
|
19
|
+
? ProviderBase<T[K]> & Partial<ProviderProps<T[K]>>
|
|
20
|
+
: ProviderBase<T[K]> & ProviderProps<T[K]>;
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
// oxlint-disable-next-line no-explicit-any
|
|
25
|
+
interface Props<T extends any[]> {
|
|
26
|
+
providers: ProvidersArray<T>;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// oxlint-disable-next-line no-explicit-any
|
|
31
|
+
function Providers<T extends any[]>({ providers, children }: Props<T>) {
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
{providers.reduceRight(
|
|
35
|
+
(child, { provider: Provider, props }) => (
|
|
36
|
+
<Provider {...props}>{child}</Provider>
|
|
37
|
+
),
|
|
38
|
+
children,
|
|
39
|
+
)}
|
|
40
|
+
</>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default Providers;
|