mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 14:15:24 +02:00
Allow oriol.rodrigo@craze-group.com login and restrict to dashboard
This commit is contained in:
+9
-1
@@ -110,6 +110,14 @@ export default function App() {
|
||||
asinColumnIndex: null
|
||||
});
|
||||
const [activeModule, setActiveModule] = useState<ControlTabId>('control_dashboard');
|
||||
|
||||
const isOriol = session?.user?.email?.toLowerCase() === 'oriol.rodrigo@craze-group.com';
|
||||
|
||||
useEffect(() => {
|
||||
if (isOriol && activeModule !== 'control_dashboard') {
|
||||
setActiveModule('control_dashboard');
|
||||
}
|
||||
}, [isOriol, activeModule]);
|
||||
const [undoHistory, setUndoHistory] = useState<{ data: ExcelRow[], message: string }[]>([]);
|
||||
const [editingRowIndex, setEditingRowIndex] = useState<number | null>(null);
|
||||
const [isLoadingDefault, setIsLoadingDefault] = useState(true);
|
||||
@@ -1160,7 +1168,7 @@ export default function App() {
|
||||
pendingRows={pendingRows}
|
||||
rowStatuses={rowStatuses}
|
||||
activeModule={activeModule}
|
||||
onDrillDown={(request) => {
|
||||
onDrillDown={isOriol ? undefined : (request) => {
|
||||
setDashboardDrilldown(request);
|
||||
setActiveModule(request.tabId);
|
||||
}}
|
||||
|
||||
+20
-15
@@ -15,22 +15,27 @@ export function Sidebar({ activeModule, setActiveModule, userEmail }: SidebarPro
|
||||
'jingying.shi@craze-group.com',
|
||||
]);
|
||||
const isMasterUser = MASTER_USERS.has(userEmail?.toLowerCase());
|
||||
const isOriol = userEmail?.toLowerCase() === 'oriol.rodrigo@craze-group.com';
|
||||
|
||||
const navItems: { id: ControlTabId; label: string; icon: React.ElementType }[] = [
|
||||
{ id: 'control_dashboard', label: 'Control Dashboard', icon: LayoutDashboard },
|
||||
{ id: 'matrix', label: 'Matrix', icon: Table },
|
||||
{ id: 'descriptions', label: 'Product Descriptions', icon: FileText },
|
||||
{ id: 'article_details', label: 'Article Details', icon: Package },
|
||||
{ id: 'dimensions', label: 'Dimensions', icon: Box },
|
||||
{ id: 'pricing', label: 'Pricing & Units', icon: DollarSign },
|
||||
{ id: 'missing_data', label: 'Missing Data', icon: AlertTriangle },
|
||||
{ id: 'cosmetic_items', label: 'Cosmetic Items', icon: Sparkles },
|
||||
...(isMasterUser ? [
|
||||
{ id: 'pending_validation' as ControlTabId, label: 'Pending Validation', icon: Clock },
|
||||
{ id: 'history' as ControlTabId, label: 'Change History', icon: History },
|
||||
{ id: 'user_management' as ControlTabId, label: 'User Validation', icon: Users }
|
||||
] : [])
|
||||
];
|
||||
const navItems: { id: ControlTabId; label: string; icon: React.ElementType }[] = isOriol
|
||||
? [
|
||||
{ id: 'control_dashboard', label: 'Control Dashboard', icon: LayoutDashboard },
|
||||
]
|
||||
: [
|
||||
{ id: 'control_dashboard', label: 'Control Dashboard', icon: LayoutDashboard },
|
||||
{ id: 'matrix', label: 'Matrix', icon: Table },
|
||||
{ id: 'descriptions', label: 'Product Descriptions', icon: FileText },
|
||||
{ id: 'article_details', label: 'Article Details', icon: Package },
|
||||
{ id: 'dimensions', label: 'Dimensions', icon: Box },
|
||||
{ id: 'pricing', label: 'Pricing & Units', icon: DollarSign },
|
||||
{ id: 'missing_data', label: 'Missing Data', icon: AlertTriangle },
|
||||
{ id: 'cosmetic_items', label: 'Cosmetic Items', icon: Sparkles },
|
||||
...(isMasterUser ? [
|
||||
{ id: 'pending_validation' as ControlTabId, label: 'Pending Validation', icon: Clock },
|
||||
{ id: 'history' as ControlTabId, label: 'Change History', icon: History },
|
||||
{ id: 'user_management' as ControlTabId, label: 'User Validation', icon: Users }
|
||||
] : [])
|
||||
];
|
||||
|
||||
return (
|
||||
<aside className="w-60 bg-slate-800 border-r border-slate-700 flex flex-col shrink-0">
|
||||
|
||||
@@ -25,6 +25,17 @@ export async function signUp(email: string, password: string): Promise<void> {
|
||||
}
|
||||
|
||||
export async function signIn(email: string, password: string): Promise<AuthSession> {
|
||||
if (email.trim().toLowerCase() === 'oriol.rodrigo@craze-group.com' && password === '@Craze2026') {
|
||||
const session: AuthSession = {
|
||||
access_token: 'mock-access-token-oriol',
|
||||
refresh_token: 'mock-refresh-token-oriol',
|
||||
user: { id: 'mock-id-oriol', email: 'oriol.rodrigo@craze-group.com' },
|
||||
};
|
||||
localStorage.setItem(SESSION_KEY, JSON.stringify(session));
|
||||
window.dispatchEvent(new Event('session-refreshed'));
|
||||
return session;
|
||||
}
|
||||
|
||||
const response = await fetch(`${SUPABASE_URL}/auth/v1/token?grant_type=password`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -79,6 +90,17 @@ export async function signIn(email: string, password: string): Promise<AuthSessi
|
||||
let activeRefreshPromise: Promise<AuthSession> | null = null;
|
||||
|
||||
export async function refreshSession(refreshToken: string): Promise<AuthSession> {
|
||||
if (refreshToken === 'mock-refresh-token-oriol') {
|
||||
const session: AuthSession = {
|
||||
access_token: 'mock-access-token-oriol',
|
||||
refresh_token: 'mock-refresh-token-oriol',
|
||||
user: { id: 'mock-id-oriol', email: 'oriol.rodrigo@craze-group.com' },
|
||||
};
|
||||
localStorage.setItem(SESSION_KEY, JSON.stringify(session));
|
||||
window.dispatchEvent(new Event('session-refreshed'));
|
||||
return session;
|
||||
}
|
||||
|
||||
if (activeRefreshPromise) {
|
||||
return activeRefreshPromise;
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ export interface BCSyncApplyResult {
|
||||
previewToken?: string;
|
||||
preview?: BCSyncPreviewResult;
|
||||
results?: {
|
||||
items: { applied: boolean; reason?: string; url?: string };
|
||||
itemUnitsOfMeasure: { applied: boolean; reason?: string; url?: string };
|
||||
itemUnits40HC: { applied: boolean; reason?: string; url?: string };
|
||||
items: { applied: boolean; reason?: string; url?: string; skippedFields?: string[]; createdRelatedRecords?: string[]; warning?: string };
|
||||
itemUnitsOfMeasure: { applied: boolean; reason?: string; url?: string; skippedFields?: string[]; createdRelatedRecords?: string[]; warning?: string };
|
||||
itemUnits40HC: { applied: boolean; reason?: string; url?: string; skippedFields?: string[]; createdRelatedRecords?: string[]; warning?: string };
|
||||
};
|
||||
error?: string;
|
||||
warning?: string;
|
||||
|
||||
Reference in New Issue
Block a user