create-varity-app 2.0.0-beta.13 → 2.0.0-beta.14
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
|
@@ -4,6 +4,7 @@ import { useState, useEffect, useCallback } from 'react';
|
|
|
4
4
|
import { useRouter, usePathname } from 'next/navigation';
|
|
5
5
|
import { APP_NAME, NAVIGATION_ITEMS } from '@/lib/constants';
|
|
6
6
|
import { useProjects, useTasks, useTeam } from '@/lib/hooks';
|
|
7
|
+
import { withBasePath } from '@/lib/utils';
|
|
7
8
|
import { CommandPalette } from '@varity-labs/ui-kit';
|
|
8
9
|
import { Menu, X } from 'lucide-react';
|
|
9
10
|
|
|
@@ -24,7 +25,7 @@ try {
|
|
|
24
25
|
function RedirectToLogin() {
|
|
25
26
|
const router = useRouter();
|
|
26
27
|
useEffect(() => {
|
|
27
|
-
router.push('/login');
|
|
28
|
+
router.push(withBasePath('/login'));
|
|
28
29
|
}, [router]);
|
|
29
30
|
return null;
|
|
30
31
|
}
|
|
@@ -154,7 +155,7 @@ function DashboardShell({ children }: { children: React.ReactNode }) {
|
|
|
154
155
|
|
|
155
156
|
const handleLogout = async () => {
|
|
156
157
|
await logout();
|
|
157
|
-
|
|
158
|
+
window.location.href = withBasePath('/');
|
|
158
159
|
};
|
|
159
160
|
|
|
160
161
|
// Fallback layout when DashboardLayout from ui-kit isn't available
|
|
@@ -164,7 +165,7 @@ function DashboardShell({ children }: { children: React.ReactNode }) {
|
|
|
164
165
|
<CommandPalette
|
|
165
166
|
open={commandPaletteOpen}
|
|
166
167
|
onClose={() => setCommandPaletteOpen(false)}
|
|
167
|
-
onNavigate={(path: string) => router.push(path)}
|
|
168
|
+
onNavigate={(path: string) => router.push(withBasePath(path))}
|
|
168
169
|
projects={projects}
|
|
169
170
|
tasks={tasks}
|
|
170
171
|
team={team}
|
|
@@ -181,7 +182,7 @@ function DashboardShell({ children }: { children: React.ReactNode }) {
|
|
|
181
182
|
{navWithActive.map((item) => (
|
|
182
183
|
<button
|
|
183
184
|
key={item.path}
|
|
184
|
-
onClick={() => router.push(item.path)}
|
|
185
|
+
onClick={() => router.push(withBasePath(item.path))}
|
|
185
186
|
className={`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-colors ${
|
|
186
187
|
item.active
|
|
187
188
|
? 'bg-primary-50 text-primary-700'
|
|
@@ -211,7 +212,7 @@ function DashboardShell({ children }: { children: React.ReactNode }) {
|
|
|
211
212
|
navItems={navWithActive}
|
|
212
213
|
userEmail={userEmail}
|
|
213
214
|
onLogout={handleLogout}
|
|
214
|
-
onNavigate={(path) => router.push(path)}
|
|
215
|
+
onNavigate={(path) => router.push(withBasePath(path))}
|
|
215
216
|
/>
|
|
216
217
|
)}
|
|
217
218
|
|
|
@@ -228,7 +229,7 @@ function DashboardShell({ children }: { children: React.ReactNode }) {
|
|
|
228
229
|
<CommandPalette
|
|
229
230
|
open={commandPaletteOpen}
|
|
230
231
|
onClose={() => setCommandPaletteOpen(false)}
|
|
231
|
-
onNavigate={(path: string) => router.push(path)}
|
|
232
|
+
onNavigate={(path: string) => router.push(withBasePath(path))}
|
|
232
233
|
projects={projects}
|
|
233
234
|
tasks={tasks}
|
|
234
235
|
team={team}
|
|
@@ -242,7 +243,7 @@ function DashboardShell({ children }: { children: React.ReactNode }) {
|
|
|
242
243
|
navItems={navWithActive}
|
|
243
244
|
userEmail={userEmail}
|
|
244
245
|
onLogout={handleLogout}
|
|
245
|
-
onNavigate={(path) => router.push(path)}
|
|
246
|
+
onNavigate={(path) => router.push(withBasePath(path))}
|
|
246
247
|
/>
|
|
247
248
|
)}
|
|
248
249
|
|
|
@@ -258,8 +259,8 @@ function DashboardShell({ children }: { children: React.ReactNode }) {
|
|
|
258
259
|
address: userEmail,
|
|
259
260
|
}}
|
|
260
261
|
onLogout={handleLogout}
|
|
261
|
-
onNavigateToProfile={() => router.push('/dashboard/settings')}
|
|
262
|
-
onNavigateToSettings={() => router.push('/dashboard/settings')}
|
|
262
|
+
onNavigateToProfile={() => router.push(withBasePath('/dashboard/settings'))}
|
|
263
|
+
onNavigateToSettings={() => router.push(withBasePath('/dashboard/settings'))}
|
|
263
264
|
onSearchClick={() => setCommandPaletteOpen(true)}
|
|
264
265
|
searchPlaceholder="Search projects, tasks, team..."
|
|
265
266
|
>
|
|
@@ -5,6 +5,7 @@ import { useRouter } from 'next/navigation';
|
|
|
5
5
|
import Link from 'next/link';
|
|
6
6
|
import { CheckCircle } from 'lucide-react';
|
|
7
7
|
import { APP_NAME } from '@/lib/constants';
|
|
8
|
+
import { withBasePath } from '@/lib/utils';
|
|
8
9
|
|
|
9
10
|
let PrivyStackComponent: any = null;
|
|
10
11
|
let usePrivyHook: (() => { authenticated: boolean; ready: boolean; login: () => void }) | null = null;
|
|
@@ -22,7 +23,7 @@ function LoginContent() {
|
|
|
22
23
|
|
|
23
24
|
useEffect(() => {
|
|
24
25
|
if (privy?.authenticated) {
|
|
25
|
-
router.push('/dashboard');
|
|
26
|
+
router.push(withBasePath('/dashboard'));
|
|
26
27
|
}
|
|
27
28
|
}, [privy?.authenticated, router]);
|
|
28
29
|
|
|
@@ -86,7 +87,7 @@ export default function LoginPage() {
|
|
|
86
87
|
appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID}
|
|
87
88
|
thirdwebClientId={process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID}
|
|
88
89
|
loginMethods={['email', 'google']}
|
|
89
|
-
appearance={{ theme: 'light', accentColor: '#2563EB'
|
|
90
|
+
appearance={{ theme: 'light', accentColor: '#2563EB' }}
|
|
90
91
|
>
|
|
91
92
|
<LoginContent />
|
|
92
93
|
</PrivyStackComponent>
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigate using Next.js basePath-aware paths.
|
|
3
|
+
* In static export with basePath, router.push does NOT prepend basePath
|
|
4
|
+
* automatically, so we do it manually.
|
|
5
|
+
*/
|
|
6
|
+
export function getBasePath(): string {
|
|
7
|
+
return process.env.NEXT_PUBLIC_BASE_PATH || '';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function withBasePath(path: string): string {
|
|
11
|
+
const base = getBasePath();
|
|
12
|
+
if (!base) return path;
|
|
13
|
+
return `${base}${path}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
1
16
|
export function formatDate(dateString: string | undefined | null): string {
|
|
2
17
|
if (!dateString) return '—';
|
|
3
18
|
const date = new Date(dateString);
|