Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
VITE_IS_DEMO: false
BETTER_AUTH_SECRET: fyXjLxjXJowjicI2BAjxOaUsQd1QafdegZDciJE/xM8=
EMAIL_SERVER: smtp://username:password@localhost:1025
EMAIL_FROM: Start UI <[email protected]>
EMAIL_FROM: Example <[email protected]>
services:
postgres:
image: postgres
Expand Down
1 change: 1 addition & 0 deletions src/env/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const envClient = createEnv({
clientPrefix: 'VITE_',
client: {
VITE_BASE_URL: z.string().url(),
// !STARTERCONF [demoMode] Remove this VITE_IS_DEMO env var
VITE_IS_DEMO: z
.enum(['true', 'false'])
.optional()
Expand Down
2 changes: 1 addition & 1 deletion src/features/auth/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { envClient } from '@/env/client';

export const AUTH_SIGNUP_ENABLED = envClient.VITE_IS_DEMO ? false : true;
export const AUTH_SIGNUP_ENABLED = envClient.VITE_IS_DEMO ? false : true; // !STARTERCONF [demoMode] Remove the envClient.VITE_IS_DEMO condition. You can
export const AUTH_EMAIL_OTP_MOCKED = '000000';
export const AUTH_EMAIL_OTP_EXPIRATION_IN_MINUTES = 5;
7 changes: 4 additions & 3 deletions src/features/dashboard/manager/page-dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DemoAppSwitch } from '@/features/demo/demo-app-switch';
import { DemoMarketingBento } from '@/features/demo/demo-marketing-bento';
import { DemoWelcome } from '@/features/demo/demo-welcome';
import { DemoAppSwitch } from '@/features/demo/demo-app-switch'; // !STARTERCONF [demoMode] Remove this import
import { DemoMarketingBento } from '@/features/demo/demo-marketing-bento'; // !STARTERCONF [demoMode] Remove this import
import { DemoWelcome } from '@/features/demo/demo-welcome'; // !STARTERCONF [demoMode] Remove this import
import {
PageLayout,
PageLayoutContent,
Expand All @@ -16,6 +16,7 @@ export const PageDashboard = () => {
</PageLayoutTopBar>
<PageLayoutContent containerClassName="max-w-4xl">
<div className="flex flex-col gap-4">
{/* !STARTERCONF [demoMode] Update with your content */}
<DemoWelcome />
<DemoAppSwitch />
<DemoMarketingBento />
Expand Down
1 change: 1 addition & 0 deletions src/features/demo/demo-app-switch.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// !STARTERCONF [demoMode] Remove the demo folder
import { Link, useMatchRoute } from '@tanstack/react-router';
import { ArrowRightIcon } from 'lucide-react';
import { useTranslation } from 'react-i18next';
Expand Down
1 change: 1 addition & 0 deletions src/features/demo/demo-marketing-bento.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// !STARTERCONF [demoMode] Remove the demo folder
export const DemoMarketingBento = () => {
return (
<div className="grid grid-cols-2 gap-2 sm:grid-cols-3">
Expand Down
1 change: 1 addition & 0 deletions src/features/demo/demo-mode-drawer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// !STARTERCONF [demoMode] Remove the demo folder
import { create } from 'zustand';

import {
Expand Down
1 change: 1 addition & 0 deletions src/features/demo/demo-welcome.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// !STARTERCONF [demoMode] Remove the demo folder
import { useTranslation } from 'react-i18next';

import { Button } from '@/components/ui/button';
Expand Down
10 changes: 4 additions & 6 deletions src/features/devtools/login-hint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ export const LoginEmailHint = () => {
const form = useFormContext();
const mockedEmail = '[email protected]';

// !STARTERCONF [demoMode] Remove the `&& !envClient.VITE_IS_DEMO` condition
if (import.meta.env.PROD && !envClient.VITE_IS_DEMO) {
return null;
}

return (
<Alert dir="ltr">
<TerminalIcon className="size-4" />
<AlertTitle>
{envClient.VITE_IS_DEMO ? 'Demo mode' : 'Dev mode'}
</AlertTitle>
<AlertTitle>Dev mode</AlertTitle>
<AlertDescription className="flex flex-wrap text-sm leading-4">
You can login with{' '}
<button
Expand All @@ -41,16 +40,15 @@ export const LoginEmailHint = () => {
export const LoginEmailOtpHint = () => {
const form = useFormContext();

// !STARTERCONF [demoMode] Remove the `&& !envClient.VITE_IS_DEMO` condition
if (import.meta.env.PROD && !envClient.VITE_IS_DEMO) {
return null;
}

return (
<Alert dir="ltr">
<TerminalIcon className="size-4" />
<AlertTitle>
{envClient.VITE_IS_DEMO ? 'Demo mode' : 'Dev mode'}
</AlertTitle>
<AlertTitle>Dev mode</AlertTitle>
<AlertDescription className="flex text-sm leading-4">
Use the code{' '}
<button
Expand Down
7 changes: 4 additions & 3 deletions src/features/home/app/page-home.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Logo } from '@/components/brand/logo';

import { DemoAppSwitch } from '@/features/demo/demo-app-switch';
import { DemoMarketingBento } from '@/features/demo/demo-marketing-bento';
import { DemoWelcome } from '@/features/demo/demo-welcome';
import { DemoAppSwitch } from '@/features/demo/demo-app-switch'; // !STARTERCONF [demoMode] Remove this import
import { DemoMarketingBento } from '@/features/demo/demo-marketing-bento'; // !STARTERCONF [demoMode] Remove this import
import { DemoWelcome } from '@/features/demo/demo-welcome'; // !STARTERCONF [demoMode] Remove this import
import {
PageLayout,
PageLayoutContent,
Expand All @@ -17,6 +17,7 @@ export const PageHome = () => {
</PageLayoutTopBar>
<PageLayoutContent>
<div className="flex flex-1 flex-col gap-4">
{/* !STARTERCONF [demoMode] Update with your content */}
<DemoWelcome />
<DemoAppSwitch />
<DemoMarketingBento />
Expand Down
3 changes: 2 additions & 1 deletion src/lib/orpc/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import { createORPCReactQueryUtils } from '@orpc/react-query';
import type { RouterClient } from '@orpc/server';

import { envClient } from '@/env/client';
import { openDemoModeDrawer } from '@/features/demo/demo-mode-drawer';
import { openDemoModeDrawer } from '@/features/demo/demo-mode-drawer'; // !STARTERCONF [demoMode] Remove this import

import type { Router } from './types';

const link = new RPCLink({
url: `${envClient.VITE_BASE_URL}/api/rpc`,
interceptors: [
onError((error) => {
// !STARTERCONF [demoMode] Remove this condition
if (error instanceof ORPCError && error.message === 'DEMO_MODE_ENABLED') {
openDemoModeDrawer();
}
Expand Down
4 changes: 2 additions & 2 deletions src/locales/ar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import book from './book.json' assert { type: 'json' };
import buildInfo from './build-info.json' assert { type: 'json' };
import common from './common.json' assert { type: 'json' };
import components from './components.json' assert { type: 'json' };
import demo from './demo.json' assert { type: 'json' };
import demo from './demo.json' assert { type: 'json' }; // !STARTERCONF [demoMode] Remove this import and the file
import emails from './emails.json' assert { type: 'json' };
import genre from './genre.json' assert { type: 'json' };
import layout from './layout.json' assert { type: 'json' };
Expand All @@ -20,7 +20,7 @@ export default {
buildInfo,
common,
components,
demo,
demo, // !STARTERCONF [demoMode] Remove this export
emails,
genre,
layout,
Expand Down
4 changes: 2 additions & 2 deletions src/locales/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import book from './book.json' assert { type: 'json' };
import buildInfo from './build-info.json' assert { type: 'json' };
import common from './common.json' assert { type: 'json' };
import components from './components.json' assert { type: 'json' };
import demo from './demo.json' assert { type: 'json' };
import demo from './demo.json' assert { type: 'json' }; // !STARTERCONF [demoMode] Remove this import and the file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Move starter comment above the import/export to satisfy Biome.

Biome now fails with Expected a semicolon or an implicit semicolon after a statement on this line: the trailing // !STARTERCONF … placed after the assert { type: 'json' } import (and the matching export) breaks its parser. Shift the starter note onto its own line immediately before the statement so linting/CI can succeed.

- import demo from './demo.json' assert { type: 'json' }; // !STARTERCONF [demoMode] Remove this import and the file
+// !STARTERCONF [demoMode] Remove this import and the file
+import demo from './demo.json' assert { type: 'json' };

-  demo, // !STARTERCONF [demoMode] Remove this export
+  // !STARTERCONF [demoMode] Remove this export
+  demo,

Also applies to: 23-23

🧰 Tools
🪛 Biome (2.1.2)

[error] 10-10: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 10-10: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)

🤖 Prompt for AI Agents
In src/locales/en/index.ts around lines 10 and 23, the trailing inline starter
comment after the import/export statement breaks Biome's parser; move the
starter comment onto its own line immediately above the affected import and
export statements (i.e., place "// !STARTERCONF [demoMode] Remove this import
and the file" on a separate line before the import at line 10 and the
corresponding export at line 23) so the import/export end with a proper
semicolon and linting/CI will succeed.

import emails from './emails.json' assert { type: 'json' };
import genre from './genre.json' assert { type: 'json' };
import layout from './layout.json' assert { type: 'json' };
Expand All @@ -20,7 +20,7 @@ export default {
buildInfo,
common,
components,
demo,
demo, // !STARTERCONF [demoMode] Remove this export
emails,
genre,
layout,
Expand Down
4 changes: 2 additions & 2 deletions src/locales/fr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import book from './book.json' assert { type: 'json' };
import buildInfo from './build-info.json' assert { type: 'json' };
import common from './common.json' assert { type: 'json' };
import components from './components.json' assert { type: 'json' };
import demo from './demo.json' assert { type: 'json' };
import demo from './demo.json' assert { type: 'json' }; // !STARTERCONF [demoMode] Remove this import and the file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Same Biome parse error: relocate the inline starter comment.

Biome reports the identical parse failure here because the starter annotation trails the assert import/export. Move the comment onto the preceding line so linting resumes working.

- import demo from './demo.json' assert { type: 'json' }; // !STARTERCONF [demoMode] Remove this import and the file
+// !STARTERCONF [demoMode] Remove this import and the file
+import demo from './demo.json' assert { type: 'json' };

-  demo, // !STARTERCONF [demoMode] Remove this export
+  // !STARTERCONF [demoMode] Remove this export
+  demo,

Also applies to: 23-23

🧰 Tools
🪛 Biome (2.1.2)

[error] 10-10: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 10-10: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)

🤖 Prompt for AI Agents
In src/locales/fr/index.ts around lines 10 and 23, the inline starter comment
sits after an import/assert expression causing Biome parse errors; relocate the
starter annotation to the previous line (place the comment immediately above the
import/export statement it annotates) for both occurrences so the comment does
not trail the import/assert syntax and linting/parsing will succeed.

import emails from './emails.json' assert { type: 'json' };
import genre from './genre.json' assert { type: 'json' };
import layout from './layout.json' assert { type: 'json' };
Expand All @@ -20,7 +20,7 @@ export default {
buildInfo,
common,
components,
demo,
demo, // !STARTERCONF [demoMode] Remove this export
emails,
genre,
layout,
Expand Down
4 changes: 2 additions & 2 deletions src/locales/sw/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import book from './book.json' assert { type: 'json' };
import buildInfo from './build-info.json' assert { type: 'json' };
import common from './common.json' assert { type: 'json' };
import components from './components.json' assert { type: 'json' };
import demo from './demo.json' assert { type: 'json' };
import demo from './demo.json' assert { type: 'json' }; // !STARTERCONF [demoMode] Remove this import and the file
import emails from './emails.json' assert { type: 'json' };
import genre from './genre.json' assert { type: 'json' };
import layout from './layout.json' assert { type: 'json' };
Expand All @@ -20,7 +20,7 @@ export default {
buildInfo,
common,
components,
demo,
demo, // !STARTERCONF [demoMode] Remove this export
emails,
genre,
layout,
Expand Down
9 changes: 6 additions & 3 deletions src/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import { Sonner } from '@/components/ui/sonner';

import { envClient } from '@/env/client';
import {
DemoModeDrawer,
useIsDemoModeDrawerVisible,
DemoModeDrawer, // !STARTERCONF [demoMode] Remove this import
useIsDemoModeDrawerVisible, // !STARTERCONF [demoMode] Remove this import
} from '@/features/demo/demo-mode-drawer';

export const Providers = (props: { children: ReactNode }) => {
const isDemoModeDrawerVisible = useIsDemoModeDrawerVisible();
const isDemoModeDrawerVisible = useIsDemoModeDrawerVisible(); // !STARTERCONF [demoMode] Remove this line
return (
<ThemeProvider
attribute="class"
Expand All @@ -23,7 +23,10 @@ export const Providers = (props: { children: ReactNode }) => {
>
<QueryClientProvider>
{props.children}
{/* !STARTERCONF [demoMode] Remove the `!isDemoModeDrawerVisible` condition (keep the <Sonner /> component) */}
{!isDemoModeDrawerVisible && <Sonner />}

{/* !STARTERCONF [demoMode] Remove the <DemoModeDrawer /> */}
{envClient.VITE_IS_DEMO && <DemoModeDrawer />}
</QueryClientProvider>
</ThemeProvider>
Expand Down
4 changes: 2 additions & 2 deletions src/server/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export const auth = betterAuth({
emailOTP({
disableSignUp: !AUTH_SIGNUP_ENABLED,
expiresIn: AUTH_EMAIL_OTP_EXPIRATION_IN_MINUTES * 60,
// Use predictable mocked code in dev and demo
...(import.meta.env.DEV || envClient.VITE_IS_DEMO
// Use predictable mocked code in dev
...(import.meta.env.DEV || envClient.VITE_IS_DEMO // !STARTERCONF [demoMode] Remove the `|| envClient.VITE_IS_DEMO` condition
? { generateOTP: () => AUTH_EMAIL_OTP_MOCKED }
: undefined),
async sendVerificationOTP({ email, otp, type }) {
Expand Down
1 change: 1 addition & 0 deletions src/server/email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const sendEmail = async ({
...options
}: Omit<MailOptions, 'html'> &
Required<Pick<MailOptions, 'subject'>> & { template: ReactElement }) => {
// !STARTERCONF [demoMode] Remove this condition
if (envClient.VITE_IS_DEMO) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/server/orpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const base = os
return result;
});
})
// !STARTERCONF [demoMode] Remove this middleware (the .use(...))
// Demo Mode
.use(async ({ next, procedure }) => {
if (envClient.VITE_IS_DEMO && procedure['~orpc'].route.method !== 'GET') {
Expand Down
Loading