create-mercato-app 0.5.1-develop.2727.5af6be1c11 → 0.5.1-develop.2744.9c8be0dd93

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mercato-app",
3
- "version": "0.5.1-develop.2727.5af6be1c11",
3
+ "version": "0.5.1-develop.2744.9c8be0dd93",
4
4
  "type": "module",
5
5
  "description": "Create a new Open Mercato application",
6
6
  "main": "./dist/index.js",
@@ -13,6 +13,8 @@ import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
13
13
  import type { EntityManager } from '@mikro-orm/postgresql'
14
14
  import { User } from '@open-mercato/core/modules/auth/data/entities'
15
15
  import { Tenant, Organization } from '@open-mercato/core/modules/directory/data/entities'
16
+ import { buildHomeQuickLinks } from '@/lib/homeQuickLinks'
17
+ import { Fragment } from 'react'
16
18
 
17
19
  function FeatureBadge({ label }: { label: string }) {
18
20
  return (
@@ -48,6 +50,7 @@ for (const route of apiRoutes) {
48
50
 
49
51
  export default async function Home() {
50
52
  const { t } = await resolveTranslations()
53
+ const quickLinks = buildHomeQuickLinks(modules)
51
54
 
52
55
  // Check if user wants to see the start page
53
56
  const cookieStore = await cookies()
@@ -143,15 +146,14 @@ export default async function Home() {
143
146
  <section className="rounded-lg border bg-card p-4">
144
147
  <div className="text-sm font-medium mb-2">{t('app.page.quickLinks.title', 'Quick Links')}</div>
145
148
  <div className="flex flex-wrap items-center gap-3 text-sm">
146
- <Link className="underline hover:text-primary transition-colors" href="/login">{t('app.page.quickLinks.login', 'Login')}</Link>
147
- <span className="text-muted-foreground">·</span>
148
- <Link className="underline hover:text-primary transition-colors" href="/example">{t('app.page.quickLinks.examplePage', 'Example Page')}</Link>
149
- <span className="text-muted-foreground">·</span>
150
- <Link className="underline hover:text-primary transition-colors" href="/backend/example">{t('app.page.quickLinks.exampleAdmin', 'Example Admin')}</Link>
151
- <span className="text-muted-foreground">·</span>
152
- <Link className="underline hover:text-primary transition-colors" href="/backend/todos">{t('app.page.quickLinks.exampleTodos', 'Example Todos with Custom Fields')}</Link>
153
- <span className="text-muted-foreground">·</span>
154
- <Link className="underline hover:text-primary transition-colors" href="/blog/123">{t('app.page.quickLinks.exampleBlog', 'Example Blog Post')}</Link>
149
+ {quickLinks.map((link, index) => (
150
+ <Fragment key={link.href}>
151
+ {index > 0 ? <span className="text-muted-foreground">·</span> : null}
152
+ <Link className="underline hover:text-primary transition-colors" href={link.href}>
153
+ {t(link.translationKey, link.fallbackLabel)}
154
+ </Link>
155
+ </Fragment>
156
+ ))}
155
157
  </div>
156
158
  </section>
157
159
 
@@ -0,0 +1,28 @@
1
+ type ModuleLike = { id: string }
2
+
3
+ export type HomeQuickLink = {
4
+ href: string
5
+ translationKey: string
6
+ fallbackLabel: string
7
+ }
8
+
9
+ const EXAMPLE_MODULE_ID = 'example'
10
+
11
+ const BASE_LINKS: HomeQuickLink[] = [
12
+ { href: '/login', translationKey: 'app.page.quickLinks.login', fallbackLabel: 'Login' },
13
+ ]
14
+
15
+ const EXAMPLE_LINKS: HomeQuickLink[] = [
16
+ { href: '/example', translationKey: 'app.page.quickLinks.examplePage', fallbackLabel: 'Example Page' },
17
+ { href: '/backend/example', translationKey: 'app.page.quickLinks.exampleAdmin', fallbackLabel: 'Example Admin' },
18
+ { href: '/backend/todos', translationKey: 'app.page.quickLinks.exampleTodos', fallbackLabel: 'Example Todos with Custom Fields' },
19
+ { href: '/blog/123', translationKey: 'app.page.quickLinks.exampleBlog', fallbackLabel: 'Example Blog Post' },
20
+ ]
21
+
22
+ export function buildHomeQuickLinks(modules: readonly ModuleLike[]): HomeQuickLink[] {
23
+ if (modules.some((module) => module.id === EXAMPLE_MODULE_ID)) {
24
+ return [...BASE_LINKS, ...EXAMPLE_LINKS]
25
+ }
26
+
27
+ return BASE_LINKS
28
+ }