feat(login): remodela a tela de login/cadastro com as funcionalidades atuais
- novo painel showcase (marketplace de profissionais por proximidade, locação de salas, agenda anti-overbooking, financeiro/GTO, RX, busca por proximidade) - chips de perfis incl. biomédico(a); visual escuro moderno; splash mais rápido - mantém login, recuperar/redefinir senha e cadastro via OnboardingChat - App.tsx: handler onAuthSuccess extraído (reuso pós-login) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+19
-31
@@ -382,6 +382,24 @@ const App: React.FC = () => {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
// Roteamento pós-login/cadastro.
|
||||
const onAuthSuccess = (result?: { noWorkspace?: boolean; userRole?: string }) => {
|
||||
if (result?.noWorkspace) {
|
||||
const userRole = result.userRole || 'dentista';
|
||||
if (userRole === 'superadmin') { setCurrentView('superadmin'); navigate('superadmin'); }
|
||||
else if (userRole === 'admin' || userRole === 'donoclinica' || userRole === 'donoconsultorio') { setCurrentView('criar-clinica'); navigate('criar-clinica'); }
|
||||
else { setCurrentView('aguardando-convite'); navigate('aguardando-convite'); }
|
||||
return;
|
||||
}
|
||||
const storedRole = getStoredUserRole();
|
||||
if (storedRole === 'superadmin') { setCurrentView('superadmin-overview'); navigate('superadmin-overview'); return; }
|
||||
if (storedRole === 'donoconsultorio') { setCurrentView('dashboard'); navigate('dashboard'); return; }
|
||||
const role = HybridBackend.getCurrentRole();
|
||||
const view = getDefaultViewForRole(role);
|
||||
setCurrentView(view);
|
||||
navigate(view);
|
||||
};
|
||||
|
||||
const renderView = () => {
|
||||
switch (currentView) {
|
||||
case 'landing': return <LandingPage
|
||||
@@ -433,37 +451,7 @@ const App: React.FC = () => {
|
||||
case 'diretorio-profissionais': return isPluginActive('profissionais-marketplace') ? <ProfissionaisPlugin /> : <DiretorioProfissionaisView />;
|
||||
case 'login':
|
||||
default:
|
||||
return <LoginView onLoginSuccess={(result) => {
|
||||
if (result?.noWorkspace) {
|
||||
const userRole = result.userRole || 'dentista';
|
||||
if (userRole === 'superadmin') {
|
||||
setCurrentView('superadmin');
|
||||
navigate('superadmin');
|
||||
} else if (userRole === 'admin' || userRole === 'donoclinica' || userRole === 'donoconsultorio') {
|
||||
setCurrentView('criar-clinica');
|
||||
navigate('criar-clinica');
|
||||
} else {
|
||||
setCurrentView('aguardando-convite');
|
||||
navigate('aguardando-convite');
|
||||
}
|
||||
return;
|
||||
}
|
||||
const storedRole = getStoredUserRole();
|
||||
if (storedRole === 'superadmin') {
|
||||
setCurrentView('superadmin-overview');
|
||||
navigate('superadmin-overview');
|
||||
return;
|
||||
}
|
||||
if (storedRole === 'donoconsultorio') {
|
||||
setCurrentView('dashboard');
|
||||
navigate('dashboard');
|
||||
return;
|
||||
}
|
||||
const role = HybridBackend.getCurrentRole();
|
||||
const view = getDefaultViewForRole(role);
|
||||
setCurrentView(view);
|
||||
navigate(view);
|
||||
}} />;
|
||||
return <LoginView onLoginSuccess={onAuthSuccess} />;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user