Ignore:
Timestamp:
06/23/26 17:20:47 (13 days ago)
Author:
kikisrbinoska <srbinoskakristina07@…>
Branches:
main
Children:
99c1e45
Parents:
b373fea
Message:

Fixed user profile and reading lists

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapterx-frontend/src/pages/auth/LoginPage.tsx

    rb373fea r0b502c2  
    66import { useUIStore } from '../../store/uiStore'
    77import { Button } from '../../components/ui/Button'
    8 import { Avatar } from '../../components/ui/Avatar'
    9 import { RoleBadge } from '../../components/ui/Badge'
    10 
    11 const quickUsers = [
    12   { username: 'admin_alex', name: 'Alex Admin', role: 'admin' as const },
    13   { username: 'elena_writes', name: 'Elena Dimitrova', role: 'writer' as const },
    14   { username: 'boris_writer', name: 'Boris Nikolov', role: 'writer' as const },
    15   { username: 'sara_reader', name: 'Sara Petkovska', role: 'regular' as const },
    16 ]
    178
    189export const LoginPage: React.FC = () => {
    1910  const navigate = useNavigate()
    20   const { login, switchUser } = useAuthStore()
     11  const { login } = useAuthStore()
    2112  const { addToast } = useUIStore()
    2213  const [email, setEmail] = useState('')
     
    4940  }
    5041
    51   const handleQuickLogin = (username: string) => {
    52     const { allUsers } = useAuthStore.getState()
    53     const user = allUsers.find(u => u.username === username)
    54     if (user) {
    55       switchUser(user.user_id)
    56       addToast(`Signed in as ${user.name}`)
    57       navigate('/')
    58     }
    59   }
    60 
    6142  return (
    6243    <div className="min-h-[80vh] flex items-center justify-center px-4 py-12">
     
    6950          <h1 className="font-serif text-2xl font-bold text-white">Welcome back</h1>
    7051          <p className="text-slate-400 text-sm mt-2">Sign in to your account</p>
    71         </div>
    72 
    73         {/* Quick login */}
    74         <div className="mb-6">
    75           <p className="text-xs text-slate-500 text-center mb-3">Quick demo login</p>
    76           <div className="grid grid-cols-2 gap-2">
    77             {quickUsers.map(u => (
    78               <button
    79                 key={u.username}
    80                 onClick={() => handleQuickLogin(u.username)}
    81                 className="flex items-center gap-2 p-3 bg-slate-800 border border-slate-700 rounded-xl hover:border-indigo-500/50 hover:bg-slate-700/50 transition-all group"
    82               >
    83                 <Avatar name={u.name} size="sm" />
    84                 <div className="text-left min-w-0">
    85                   <p className="text-white text-xs font-medium truncate">{u.name}</p>
    86                   <RoleBadge role={u.role} />
    87                 </div>
    88               </button>
    89             ))}
    90           </div>
    91         </div>
    92 
    93         <div className="flex items-center gap-3 mb-6">
    94           <div className="flex-1 h-px bg-slate-700" />
    95           <span className="text-slate-600 text-xs">or sign in with email</span>
    96           <div className="flex-1 h-px bg-slate-700" />
    9752        </div>
    9853
Note: See TracChangeset for help on using the changeset viewer.