d15a13e485
- Delete all ops page components (ReviewQueue, AIMonitoring, Governance, SourceMonitoring, ActivityTimeline, SignalPipeline) - Remove OPERATIONS workspace from AppShell config, nav order, path detection - Remove all /ops/* routes from App.tsx - Remove WorkspaceType.OPERATIONS from allowedWorkspaces in authService, sessionStore, permissions - Keep MarketIntelligence page (already moved to /supply/market-intelligence) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { create } from 'zustand'
|
|
import { UserRole, WorkspaceType } from '../domain/enums'
|
|
|
|
export interface MockUser {
|
|
id: string
|
|
email: string
|
|
name: string
|
|
role: UserRole
|
|
organizationId: string
|
|
organizationName: string
|
|
allowedWorkspaces: WorkspaceType[]
|
|
}
|
|
|
|
export const SessionStatus = {
|
|
UNAUTHENTICATED: 'unauthenticated',
|
|
AUTHENTICATED: 'authenticated',
|
|
EXPIRED: 'expired',
|
|
RESTRICTED: 'restricted',
|
|
ONBOARDING: 'onboarding',
|
|
} as const
|
|
export type SessionStatus = typeof SessionStatus[keyof typeof SessionStatus]
|
|
|
|
interface SessionState {
|
|
currentUser: MockUser | null
|
|
activeOrganizationId: string | null
|
|
isAuthenticated: boolean
|
|
sessionStatus: SessionStatus
|
|
login: (user: MockUser) => void
|
|
logout: () => void
|
|
switchOrganization: (organizationId: string) => void
|
|
setSessionStatus: (status: SessionStatus) => void
|
|
}
|
|
|
|
const mockUser: MockUser = {
|
|
id: 'user-001',
|
|
email: 'admin@ideal-sharing.ch',
|
|
name: 'Admin User',
|
|
role: UserRole.ORGANIZATION_ADMIN,
|
|
organizationId: 'org-wincasa',
|
|
organizationName: 'Wincasa AG',
|
|
allowedWorkspaces: [WorkspaceType.SUPPLY, WorkspaceType.DEMAND, WorkspaceType.OPERATIONS],
|
|
}
|
|
|
|
export const useSessionStore = create<SessionState>((set) => ({
|
|
currentUser: mockUser,
|
|
activeOrganizationId: mockUser.organizationId,
|
|
isAuthenticated: true,
|
|
sessionStatus: SessionStatus.AUTHENTICATED,
|
|
login: (user) => set({
|
|
currentUser: user,
|
|
activeOrganizationId: user.organizationId,
|
|
isAuthenticated: true,
|
|
sessionStatus: SessionStatus.AUTHENTICATED,
|
|
}),
|
|
logout: () => set({
|
|
currentUser: null,
|
|
activeOrganizationId: null,
|
|
isAuthenticated: false,
|
|
sessionStatus: SessionStatus.UNAUTHENTICATED,
|
|
}),
|
|
switchOrganization: (organizationId) => set({ activeOrganizationId: organizationId }),
|
|
setSessionStatus: (status) => set({ sessionStatus: status }),
|
|
}))
|