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.
Files changed (181) hide show
  1. package/package.json +1 -1
  2. package/src/emit-starter.test.ts +36 -0
  3. package/templates/auth-chat/package.json +1 -1
  4. package/templates/backend/package.json +1 -1
  5. package/templates/catalog.json +5 -0
  6. package/templates/empty/package.json +1 -1
  7. package/templates/marketplace/.config/local.spa.template.yml +27 -0
  8. package/templates/marketplace/.oxlint-base.json +29 -0
  9. package/templates/marketplace/.oxlintrc.json +78 -0
  10. package/templates/marketplace/.rulesync/rules/frontend-api-boundary.md +36 -0
  11. package/templates/marketplace/.rulesync/rules/frontend-component-structure.md +38 -0
  12. package/templates/marketplace/.rulesync/rules/frontend-forms.md +32 -0
  13. package/templates/marketplace/.rulesync/rules/frontend-notifications.md +24 -0
  14. package/templates/marketplace/.rulesync/rules/frontend-povio-components.md +42 -0
  15. package/templates/marketplace/.rulesync/rules/frontend-povio-ui.md +45 -0
  16. package/templates/marketplace/.rulesync/rules/frontend-query-autocomplete.md +29 -0
  17. package/templates/marketplace/.rulesync/rules/frontend-tables-and-lists.md +34 -0
  18. package/templates/marketplace/.rulesync/rules/frontend-translations.md +26 -0
  19. package/templates/marketplace/.rulesync/rules/project-overview.md +32 -0
  20. package/templates/marketplace/.rulesync/rules/robodev-api.md +30 -0
  21. package/templates/marketplace/.rulesync/rules/robodev-auth.md +40 -0
  22. package/templates/marketplace/.rulesync/rules/robodev-database.md +22 -0
  23. package/templates/marketplace/.rulesync/rules/role-based-app-structure.md +36 -0
  24. package/templates/marketplace/.rulesync/skills/media-feature/SKILL.md +21 -0
  25. package/templates/marketplace/.rulesync/skills/povio-ui-styling/SKILL.md +208 -0
  26. package/templates/marketplace/.rulesync/skills/povio-ui-styling/agents/openai.yaml +4 -0
  27. package/templates/marketplace/.rulesync/skills/robodev-api-route/SKILL.md +13 -0
  28. package/templates/marketplace/.rulesync/skills/robodev-table/SKILL.md +12 -0
  29. package/templates/marketplace/README.md +40 -0
  30. package/templates/marketplace/api/_lib.seed.test.ts +10 -0
  31. package/templates/marketplace/api/_lib.ts +734 -0
  32. package/templates/marketplace/api/cart/[id].ts +51 -0
  33. package/templates/marketplace/api/cart.ts +70 -0
  34. package/templates/marketplace/api/categories.ts +11 -0
  35. package/templates/marketplace/api/checkout.ts +157 -0
  36. package/templates/marketplace/api/health.ts +7 -0
  37. package/templates/marketplace/api/listings/[id].ts +101 -0
  38. package/templates/marketplace/api/listings/paginate.ts +29 -0
  39. package/templates/marketplace/api/listings.ts +90 -0
  40. package/templates/marketplace/api/me.ts +14 -0
  41. package/templates/marketplace/api/orders/[id]/complete.ts +27 -0
  42. package/templates/marketplace/api/orders/[id]/ship.ts +24 -0
  43. package/templates/marketplace/api/orders/[id].ts +15 -0
  44. package/templates/marketplace/api/purchases.ts +19 -0
  45. package/templates/marketplace/api/reviews.ts +58 -0
  46. package/templates/marketplace/api/sales.ts +19 -0
  47. package/templates/marketplace/api/watches/[listingId].ts +18 -0
  48. package/templates/marketplace/api/watches.ts +51 -0
  49. package/templates/marketplace/apps/fe/index.html +24 -0
  50. package/templates/marketplace/apps/fe/openapi-codegen.config.ts +72 -0
  51. package/templates/marketplace/apps/fe/package.json +84 -0
  52. package/templates/marketplace/apps/fe/public/apple-touch-icon.png +0 -0
  53. package/templates/marketplace/apps/fe/public/favicon-96x96.png +0 -0
  54. package/templates/marketplace/apps/fe/public/favicon.ico +0 -0
  55. package/templates/marketplace/apps/fe/public/favicon.svg +3 -0
  56. package/templates/marketplace/apps/fe/public/site.webmanifest +21 -0
  57. package/templates/marketplace/apps/fe/public/web-app-manifest-192x192.png +0 -0
  58. package/templates/marketplace/apps/fe/public/web-app-manifest-512x512.png +0 -0
  59. package/templates/marketplace/apps/fe/src/assets/fonts/GeneralSans-Bold.otf +0 -0
  60. package/templates/marketplace/apps/fe/src/assets/fonts/GeneralSans-Medium.otf +0 -0
  61. package/templates/marketplace/apps/fe/src/assets/fonts/GeneralSans-Regular.otf +0 -0
  62. package/templates/marketplace/apps/fe/src/assets/fonts/GeneralSans-Semibold.otf +0 -0
  63. package/templates/marketplace/apps/fe/src/assets/locales/en/translation.json +336 -0
  64. package/templates/marketplace/apps/fe/src/assets/locales/sl/translation.json +336 -0
  65. package/templates/marketplace/apps/fe/src/clients/app-rest-client.ts +15 -0
  66. package/templates/marketplace/apps/fe/src/clients/auth-token-store.ts +101 -0
  67. package/templates/marketplace/apps/fe/src/clients/rest/app-error-handler.ts +31 -0
  68. package/templates/marketplace/apps/fe/src/clients/rest/interceptors/authorization-header.interceptor.ts +15 -0
  69. package/templates/marketplace/apps/fe/src/clients/rest/interceptors/refresh-token.interceptor.ts +37 -0
  70. package/templates/marketplace/apps/fe/src/clients/rest/interceptors/response.interceptor.ts +17 -0
  71. package/templates/marketplace/apps/fe/src/components/404.tsx +18 -0
  72. package/templates/marketplace/apps/fe/src/components/features/auth/AuthBrandPanel.tsx +60 -0
  73. package/templates/marketplace/apps/fe/src/components/features/auth/AuthLayout.tsx +23 -0
  74. package/templates/marketplace/apps/fe/src/components/features/auth/LoginPage.tsx +111 -0
  75. package/templates/marketplace/apps/fe/src/components/features/auth/RegisterPage.tsx +143 -0
  76. package/templates/marketplace/apps/fe/src/components/features/marketplace/BrowsePage.tsx +76 -0
  77. package/templates/marketplace/apps/fe/src/components/features/marketplace/CartPage.tsx +88 -0
  78. package/templates/marketplace/apps/fe/src/components/features/marketplace/CheckoutPage.tsx +193 -0
  79. package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingCard.tsx +50 -0
  80. package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingDetailsPage.tsx +194 -0
  81. package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingForm.tsx +278 -0
  82. package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingFormPage.tsx +27 -0
  83. package/templates/marketplace/apps/fe/src/components/features/marketplace/ListingGallery.tsx +54 -0
  84. package/templates/marketplace/apps/fe/src/components/features/marketplace/MyListingsPage.tsx +137 -0
  85. package/templates/marketplace/apps/fe/src/components/features/marketplace/OrderStatusTag.tsx +24 -0
  86. package/templates/marketplace/apps/fe/src/components/features/marketplace/OrderSummaryCard.tsx +39 -0
  87. package/templates/marketplace/apps/fe/src/components/features/marketplace/OrdersPage.tsx +236 -0
  88. package/templates/marketplace/apps/fe/src/components/features/marketplace/WatchlistPage.tsx +56 -0
  89. package/templates/marketplace/apps/fe/src/components/features/profile/ProfilePage.tsx +96 -0
  90. package/templates/marketplace/apps/fe/src/components/googleAnalytics/GoogleAnalytics.tsx +35 -0
  91. package/templates/marketplace/apps/fe/src/components/layout/AppLayout.tsx +19 -0
  92. package/templates/marketplace/apps/fe/src/components/layout/app-header/AppHeader.tsx +95 -0
  93. package/templates/marketplace/apps/fe/src/components/layout/app-header/MobileNavigation.tsx +55 -0
  94. package/templates/marketplace/apps/fe/src/components/layout/app-header/NavLink.tsx +29 -0
  95. package/templates/marketplace/apps/fe/src/components/shared/branding/BrandLogo.tsx +13 -0
  96. package/templates/marketplace/apps/fe/src/components/shared/error/ErrorFallback.tsx +43 -0
  97. package/templates/marketplace/apps/fe/src/components/shared/error/ErrorText.tsx +20 -0
  98. package/templates/marketplace/apps/fe/src/components/shared/error/NotFound.tsx +36 -0
  99. package/templates/marketplace/apps/fe/src/components/shared/forms/RequiredLabel.tsx +21 -0
  100. package/templates/marketplace/apps/fe/src/components/shared/forms/RowInputWrapper.tsx +50 -0
  101. package/templates/marketplace/apps/fe/src/components/shared/head/AppHead.tsx +32 -0
  102. package/templates/marketplace/apps/fe/src/components/shared/head/DefaultAppHead.tsx +34 -0
  103. package/templates/marketplace/apps/fe/src/components/shared/layout/LoadingState.tsx +9 -0
  104. package/templates/marketplace/apps/fe/src/components/shared/layout/ThinPageWrapper.tsx +5 -0
  105. package/templates/marketplace/apps/fe/src/components/shared/page/PageHeader.tsx +69 -0
  106. package/templates/marketplace/apps/fe/src/components/shared/ui/Card.tsx +60 -0
  107. package/templates/marketplace/apps/fe/src/components/shared/ui/GoogleLoginButton.tsx +19 -0
  108. package/templates/marketplace/apps/fe/src/components/shared/ui/RequiredLabel.tsx +22 -0
  109. package/templates/marketplace/apps/fe/src/components/shared/ui/TableActions.tsx +22 -0
  110. package/templates/marketplace/apps/fe/src/config/app.config.ts +35 -0
  111. package/templates/marketplace/apps/fe/src/config/i18n.ts +43 -0
  112. package/templates/marketplace/apps/fe/src/config/inits/a11y.ts +14 -0
  113. package/templates/marketplace/apps/fe/src/config/inits/logger.ts +7 -0
  114. package/templates/marketplace/apps/fe/src/config/inits/sentry.ts +21 -0
  115. package/templates/marketplace/apps/fe/src/config/jwt.config.ts +2 -0
  116. package/templates/marketplace/apps/fe/src/config/query.config.ts +20 -0
  117. package/templates/marketplace/apps/fe/src/hooks/useAuth.ts +5 -0
  118. package/templates/marketplace/apps/fe/src/main.tsx +52 -0
  119. package/templates/marketplace/apps/fe/src/pages/(guest)/login.tsx +23 -0
  120. package/templates/marketplace/apps/fe/src/pages/(guest)/register.tsx +23 -0
  121. package/templates/marketplace/apps/fe/src/pages/(guest)/route.tsx +18 -0
  122. package/templates/marketplace/apps/fe/src/pages/(private)/cart.tsx +22 -0
  123. package/templates/marketplace/apps/fe/src/pages/(private)/checkout.tsx +22 -0
  124. package/templates/marketplace/apps/fe/src/pages/(private)/index.tsx +22 -0
  125. package/templates/marketplace/apps/fe/src/pages/(private)/listings/$id/index.tsx +37 -0
  126. package/templates/marketplace/apps/fe/src/pages/(private)/my-listings.tsx +32 -0
  127. package/templates/marketplace/apps/fe/src/pages/(private)/orders/$id.tsx +40 -0
  128. package/templates/marketplace/apps/fe/src/pages/(private)/orders/index.tsx +22 -0
  129. package/templates/marketplace/apps/fe/src/pages/(private)/profile.tsx +23 -0
  130. package/templates/marketplace/apps/fe/src/pages/(private)/route.tsx +18 -0
  131. package/templates/marketplace/apps/fe/src/pages/(private)/sales.tsx +22 -0
  132. package/templates/marketplace/apps/fe/src/pages/(private)/sell/$id.tsx +44 -0
  133. package/templates/marketplace/apps/fe/src/pages/(private)/sell/index.tsx +15 -0
  134. package/templates/marketplace/apps/fe/src/pages/(private)/watchlist.tsx +22 -0
  135. package/templates/marketplace/apps/fe/src/pages/(public)/auth.tsx +37 -0
  136. package/templates/marketplace/apps/fe/src/pages/(public)/route.tsx +9 -0
  137. package/templates/marketplace/apps/fe/src/pages/__root.tsx +164 -0
  138. package/templates/marketplace/apps/fe/src/providers/AppErrorBoundary.tsx +10 -0
  139. package/templates/marketplace/apps/fe/src/providers/OpenApiRuntimeProvider.tsx +31 -0
  140. package/templates/marketplace/apps/fe/src/providers/index.tsx +44 -0
  141. package/templates/marketplace/apps/fe/src/providers/jwt.provider.tsx +95 -0
  142. package/templates/marketplace/apps/fe/src/routeTree.gen.ts +435 -0
  143. package/templates/marketplace/apps/fe/src/styles/base.css +103 -0
  144. package/templates/marketplace/apps/fe/src/styles/fonts/fonts.tsx +10 -0
  145. package/templates/marketplace/apps/fe/src/styles/fonts/general-sans.css +31 -0
  146. package/templates/marketplace/apps/fe/src/styles/globals.css +28 -0
  147. package/templates/marketplace/apps/fe/src/styles/overrides/defaults/button.override.ts +536 -0
  148. package/templates/marketplace/apps/fe/src/styles/overrides/defaults/checkbox.override.ts +71 -0
  149. package/templates/marketplace/apps/fe/src/styles/overrides/defaults/input.override.ts +252 -0
  150. package/templates/marketplace/apps/fe/src/styles/overrides/defaults/label.override.ts +91 -0
  151. package/templates/marketplace/apps/fe/src/styles/overrides/defaults/modal.override.ts +57 -0
  152. package/templates/marketplace/apps/fe/src/styles/overrides/defaults/radio.override.ts +46 -0
  153. package/templates/marketplace/apps/fe/src/styles/overrides/defaults/table.override.ts +104 -0
  154. package/templates/marketplace/apps/fe/src/styles/overrides/defaults/tag.override.ts +66 -0
  155. package/templates/marketplace/apps/fe/src/styles/overrides/defaults/typography.override.ts +115 -0
  156. package/templates/marketplace/apps/fe/src/styles/overrides/outline.clsx.ts +10 -0
  157. package/templates/marketplace/apps/fe/src/styles/overrides/uiOverrides.override.ts +60 -0
  158. package/templates/marketplace/apps/fe/src/styles/theme.css +2177 -0
  159. package/templates/marketplace/apps/fe/src/types/i18next.d.ts +12 -0
  160. package/templates/marketplace/apps/fe/src/types/table.d.ts +17 -0
  161. package/templates/marketplace/apps/fe/src/types/ui.d.ts +26 -0
  162. package/templates/marketplace/apps/fe/src/types/vite-env.d.ts +20 -0
  163. package/templates/marketplace/apps/fe/src/utils/date.utils.ts +17 -0
  164. package/templates/marketplace/apps/fe/src/utils/image-fallback.ts +9 -0
  165. package/templates/marketplace/apps/fe/src/utils/listing-form.test.ts +69 -0
  166. package/templates/marketplace/apps/fe/src/utils/listing-form.ts +77 -0
  167. package/templates/marketplace/apps/fe/src/utils/listing-submit.ts +29 -0
  168. package/templates/marketplace/apps/fe/src/utils/number.utils.ts +12 -0
  169. package/templates/marketplace/apps/fe/src/utils/string.utils.ts +5 -0
  170. package/templates/marketplace/apps/fe/src/vite-env.d.ts +1 -0
  171. package/templates/marketplace/apps/fe/tsconfig.app.json +32 -0
  172. package/templates/marketplace/apps/fe/tsconfig.json +9 -0
  173. package/templates/marketplace/apps/fe/tsconfig.node.json +31 -0
  174. package/templates/marketplace/apps/fe/vite.config.ts +125 -0
  175. package/templates/marketplace/database.ts +154 -0
  176. package/templates/marketplace/openapi.json +2303 -0
  177. package/templates/marketplace/oxfmt.config.js +23 -0
  178. package/templates/marketplace/package.json +18 -0
  179. package/templates/marketplace/rulesync.jsonc +18 -0
  180. package/templates/marketplace/tsconfig.json +11 -0
  181. package/templates/space/package.json +1 -1
@@ -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
+ });
@@ -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,32 @@
1
+ import { createFileRoute } from "@tanstack/react-router";
2
+ import { useTranslation } from "react-i18next";
3
+ import { z } from "zod";
4
+
5
+ import { MyListingsPage } from "@/components/features/marketplace/MyListingsPage";
6
+ import { AppHead } from "@/components/shared/head/AppHead";
7
+
8
+ const myListingsSearchSchema = z.object({
9
+ create: z
10
+ .union([z.boolean(), z.string()])
11
+ .optional()
12
+ .transform((value) => value === true || value === "true"),
13
+ });
14
+
15
+ function PageComponent() {
16
+ const { t } = useTranslation();
17
+ const { create } = Route.useSearch();
18
+ return (
19
+ <>
20
+ <AppHead
21
+ title={t(($) => $.sell.head.title)}
22
+ description={t(($) => $.sell.head.description)}
23
+ />
24
+ <MyListingsPage openCreate={create} />
25
+ </>
26
+ );
27
+ }
28
+
29
+ export const Route = createFileRoute("/(private)/my-listings")({
30
+ component: PageComponent,
31
+ validateSearch: myListingsSearchSchema,
32
+ });
@@ -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,15 @@
1
+ import { Navigate, createFileRoute } from "@tanstack/react-router";
2
+
3
+ function PageComponent() {
4
+ return (
5
+ <Navigate
6
+ to="/my-listings"
7
+ search={{ create: true }}
8
+ replace
9
+ />
10
+ );
11
+ }
12
+
13
+ export const Route = createFileRoute("/(private)/sell/")({
14
+ component: PageComponent,
15
+ });
@@ -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,9 @@
1
+ import { Outlet, createFileRoute } from "@tanstack/react-router";
2
+
3
+ function PublicLayout() {
4
+ return <Outlet />;
5
+ }
6
+
7
+ export const Route = createFileRoute("/(public)")({
8
+ component: PublicLayout,
9
+ });