HonzaH commited on
Commit
2fecf66
·
verified ·
1 Parent(s): b3fcb6a

Upload 173 files

Browse files
Files changed (1) hide show
  1. src/app/(app)/dashboard/page.tsx +0 -135
src/app/(app)/dashboard/page.tsx CHANGED
@@ -97,139 +97,4 @@ export default async function DashboardPage() {
97
  </div>
98
  )
99
  }
100
- export const dynamic = 'force-dynamic'
101
-
102
- import { redirect } from 'next/navigation'
103
-
104
- import { cookies } from 'next/headers'
105
- import { isSupabaseConfigured } from 'lib/supabase/server'
106
-
107
- import { DashboardClient } from 'components/dashboard/DashboardClient'
108
-
109
-
110
- type RoomInner = {
111
- id: string
112
- name?: string | null
113
- description?: string | null
114
- date_created: string
115
- date_last_message?: string | null
116
- status: number
117
- }
118
-
119
-
120
- type RoomRowUnion = {
121
- room_id: string
122
- // Supabase can return the joined relation either as an object or as an array of objects.
123
- rooms: RoomInner | RoomInner[]
124
- }
125
-
126
-
127
- export default async function DashboardPage() {
128
- const cookieStore = await cookies()
129
- const allCookies: any[] = typeof cookieStore.getAll === 'function' ? cookieStore.getAll() : []
130
-
131
- const hasSupabaseCookie = allCookies.some((c: any) => /^sb-.*-auth-token$/.test(c.name))
132
- const hasAnonymous = Boolean(cookieStore.get && cookieStore.get('letschat_anonymous_session'))
133
-
134
- const supabaseConfigured = isSupabaseConfigured()
135
-
136
- // Only redirect to login when Supabase is configured and there's no session.
137
- if (supabaseConfigured && !hasSupabaseCookie && !hasAnonymous) {
138
- redirect('/login')
139
- }
140
-
141
- // Render client-driven dashboard; client will fetch user + rooms
142
- return (
143
- <div className="page full">
144
- <div className="wave"></div>
145
- <div className="frame">
146
- {!supabaseConfigured ? (
147
- <div className="notice notice--warning">
148
- <strong>Supabase není nakonfigurován</strong>
149
- <div>Pro plné funkce dashboardu nastavte `NEXT_PUBLIC_SUPABASE_URL` a `NEXT_PUBLIC_SUPABASE_ANON_KEY`.</div>
150
- </div>
151
- ) : (
152
- <DashboardClient initialRooms={[]} user={{ id: '', email: '' }} />
153
- )}
154
- </div>
155
- </div>
156
- )
157
-
158
- }
159
-
160
- export const dynamic = 'force-dynamic'
161
-
162
- import { redirect } from 'next/navigation'
163
-
164
- import { cookies } from 'next/headers'
165
- import { isSupabaseConfigured } from 'lib/supabase/server'
166
-
167
- import { DashboardClient } from 'components/dashboard/DashboardClient'
168
-
169
-
170
-
171
- type RoomInner = {
172
-
173
- id: string
174
-
175
- name?: string | null
176
-
177
- description?: string | null
178
-
179
- date_created: string
180
-
181
- date_last_message?: string | null
182
-
183
- status: number
184
-
185
- }
186
-
187
-
188
-
189
- type RoomRowUnion = {
190
-
191
- room_id: string
192
-
193
- // Supabase can return the joined relation either as an object or as an array of objects.
194
-
195
- rooms: RoomInner | RoomInner[]
196
-
197
- }
198
-
199
-
200
-
201
- export default async function DashboardPage() {
202
-
203
- const cookieStore = await cookies()
204
-
205
- const allCookies: any[] = typeof cookieStore.getAll === 'function' ? cookieStore.getAll() : []
206
-
207
-
208
-
209
- const hasSupabaseCookie = allCookies.some((c: any) => /^sb-.*-auth-token$/.test(c.name))
210
-
211
- const hasAnonymous = Boolean(cookieStore.get && cookieStore.get('letschat_anonymous_session'))
212
-
213
-
214
-
215
- if (!hasSupabaseCookie && !hasAnonymous) {
216
-
217
- redirect('/login')
218
-
219
- }
220
-
221
-
222
-
223
- // Render client-driven dashboard; client will fetch user + rooms
224
-
225
- return (
226
- <div className="page full">
227
- <div className="wave"></div>
228
- <div className="frame">
229
- <DashboardClient initialRooms={[]} user={{ id: '', email: '' }} />
230
- </div>
231
- </div>
232
- )
233
-
234
- }
235
 
 
97
  </div>
98
  )
99
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100