Merge all role-dispatcher pages into single files; add FileBrowser with file-type icons
- DashboardPage, Projects, RequestsPage, ProjectDetailPage, RequestDetail: each now handles team/external/client in one file via role flags — removed 10 old role-specific sub-files - Layout: client Company nav link goes directly to /company/:id when user has a single company - FileBrowser: replace emoji icons with colored extension-text badges (square); folder icon stays 📁; Adobe/Figma/design-tool colors for design files - CompaniesPage: merged team Companies + client company routing (single-company redirect, multi-company list) - FileSharing: integrated FileBrowser component - Removed: seafile API + lib, old ServerStatus, TaskDetail, role-split page files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+15
-11
@@ -12,20 +12,24 @@ export function AuthProvider({ children }) {
|
||||
|
||||
const fetchAndCacheProfile = async (authUser, attempt = 0) => {
|
||||
try {
|
||||
const { data, error } = await Promise.race([
|
||||
supabase
|
||||
.from('profiles')
|
||||
.select('*, company:companies(id, name, phone, address)')
|
||||
.eq('id', authUser.id)
|
||||
.single(),
|
||||
const [profileResult, membershipsResult] = await Promise.race([
|
||||
Promise.all([
|
||||
supabase
|
||||
.from('profiles')
|
||||
.select('*, company:companies(id, name, phone, address)')
|
||||
.eq('id', authUser.id)
|
||||
.single(),
|
||||
supabase
|
||||
.from('company_members')
|
||||
.select('company:companies(id, name, phone, address)')
|
||||
.eq('profile_id', authUser.id),
|
||||
]),
|
||||
new Promise((_, reject) => setTimeout(() => reject(new Error('Profile fetch timeout')), 8000)),
|
||||
]);
|
||||
|
||||
const { data, error } = profileResult;
|
||||
if (data) {
|
||||
const { data: memberships } = await supabase
|
||||
.from('company_members')
|
||||
.select('company:companies(id, name, phone, address)')
|
||||
.eq('profile_id', authUser.id);
|
||||
const companies = (memberships || [])
|
||||
const companies = ((membershipsResult.data || []))
|
||||
.map(membership => membership.company)
|
||||
.filter(Boolean);
|
||||
if (data.role === 'client' && data.company && !companies.some(company => company.id === data.company.id)) {
|
||||
|
||||
Reference in New Issue
Block a user