Repository navigation
PHEE-380: add Login page and Settings page with accordion sections #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import * as React from "react" | ||
| import { Accordion as AccordionPrimitive } from "radix-ui" | ||
| import { ChevronDown } from "lucide-react" | ||
| import { cn } from "@/lib/utils" | ||
|
|
||
| const Accordion = AccordionPrimitive.Root | ||
|
|
||
| function AccordionItem({ | ||
| className, | ||
| ...props | ||
| }: React.ComponentProps<typeof AccordionPrimitive.Item>) { | ||
| return ( | ||
| <AccordionPrimitive.Item | ||
| data-slot="accordion-item" | ||
| className={cn("border-b last:border-b-0", className)} | ||
| {...props} | ||
| /> | ||
| ) | ||
| } | ||
|
|
||
| function AccordionTrigger({ | ||
| className, | ||
| children, | ||
| ...props | ||
| }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) { | ||
| return ( | ||
| <AccordionPrimitive.Header className="flex"> | ||
| <AccordionPrimitive.Trigger | ||
| data-slot="accordion-trigger" | ||
| className={cn( | ||
| "flex flex-1 items-center justify-between py-4 text-sm font-medium text-foreground transition-all hover:underline outline-none [&[data-state=open]>svg]:rotate-180", | ||
| className | ||
| )} | ||
| {...props} | ||
| > | ||
| {children} | ||
| <ChevronDown className="size-4 shrink-0 text-muted-foreground transition-transform duration-200" /> | ||
| </AccordionPrimitive.Trigger> | ||
| </AccordionPrimitive.Header> | ||
| ) | ||
| } | ||
|
|
||
| function AccordionContent({ | ||
| className, | ||
| children, | ||
| ...props | ||
| }: React.ComponentProps<typeof AccordionPrimitive.Content>) { | ||
| return ( | ||
| <AccordionPrimitive.Content | ||
| data-slot="accordion-content" | ||
| className="overflow-hidden text-sm data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" | ||
| {...props} | ||
| > | ||
| <div className={cn("pb-4 pt-0", className)}>{children}</div> | ||
| </AccordionPrimitive.Content> | ||
| ) | ||
| } | ||
|
|
||
| export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import * as React from "react" | ||
| import { Checkbox as CheckboxPrimitive } from "radix-ui" | ||
| import { CheckIcon } from "lucide-react" | ||
| import { cn } from "@/lib/utils" | ||
|
|
||
| function Checkbox({ | ||
| className, | ||
| ...props | ||
| }: React.ComponentProps<typeof CheckboxPrimitive.Root>) { | ||
| return ( | ||
| <CheckboxPrimitive.Root | ||
| data-slot="checkbox" | ||
| className={cn( | ||
| "peer size-4 shrink-0 rounded border border-input bg-transparent transition-colors outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-[#1565C0] data-[state=checked]:border-[#1565C0] data-[state=checked]:text-white", | ||
| className | ||
| )} | ||
| {...props} | ||
| > | ||
| <CheckboxPrimitive.Indicator className="flex items-center justify-center"> | ||
| <CheckIcon className="size-3" /> | ||
| </CheckboxPrimitive.Indicator> | ||
| </CheckboxPrimitive.Root> | ||
| ) | ||
| } | ||
|
|
||
| export { Checkbox } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import * as React from "react" | ||
| import { Switch as SwitchPrimitive } from "radix-ui" | ||
| import { cn } from "@/lib/utils" | ||
|
|
||
| function Switch({ | ||
| className, | ||
| ...props | ||
| }: React.ComponentProps<typeof SwitchPrimitive.Root>) { | ||
| return ( | ||
| <SwitchPrimitive.Root | ||
| data-slot="switch" | ||
| className={cn( | ||
| "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-[#1565C0] data-[state=unchecked]:bg-gray-200", | ||
| className | ||
| )} | ||
| {...props} | ||
| > | ||
| <SwitchPrimitive.Thumb | ||
| className="pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0" | ||
| /> | ||
| </SwitchPrimitive.Root> | ||
| ) | ||
| } | ||
|
|
||
| export { Switch } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| import React, { useState } from 'react' | ||
| import { useNavigate } from 'react-router-dom' | ||
| import { User, Lock, Eye, EyeOff } from 'lucide-react' | ||
| import { Input } from '@/components/ui/input' | ||
| import { Button } from '@/components/ui/button' | ||
| import { Label } from '@/components/ui/label' | ||
| import { Checkbox } from '@/components/ui/checkbox' | ||
| import { | ||
| Select, | ||
| SelectContent, | ||
| SelectItem, | ||
| SelectTrigger, | ||
| SelectValue, | ||
| } from '@/components/ui/select' | ||
|
|
||
| const TENANTS = ['greenbank', 'bluebank', 'redbank'] | ||
|
|
||
| export default function Login() { | ||
| const navigate = useNavigate() | ||
| const [username, setUsername] = useState('') | ||
| const [password, setPassword] = useState('') | ||
| const [tenant, setTenant] = useState('') | ||
| const [rememberMe, setRememberMe] = useState(false) | ||
| const [showPassword, setShowPassword] = useState(false) | ||
|
|
||
| function handleSubmit(e: React.FormEvent) { | ||
| e.preventDefault() | ||
| if (username === 'mifos' && password === 'password') { | ||
| navigate('/') | ||
| } else { | ||
| alert('Invalid credentials. Use mifos / password.') | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <div className="min-h-screen bg-[#1565C0] flex items-center justify-center p-4"> | ||
| <div className="w-full max-w-md bg-white rounded-2xl shadow-xl p-8 space-y-6"> | ||
| {/* Logo + title */} | ||
| <div className="flex flex-col items-center gap-2"> | ||
| <img | ||
| src="/payment-hub-ee.png" | ||
| alt="Payment Hub EE" | ||
| className="h-12 object-contain" | ||
| onError={(e) => { | ||
| e.currentTarget.style.display = 'none' | ||
| }} | ||
| /> | ||
| <div className="text-center"> | ||
| <p className="text-xl font-bold text-gray-900">Payment Hub EE</p> | ||
| <p className="text-sm text-muted-foreground">Operations</p> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Form */} | ||
| <form onSubmit={handleSubmit} className="space-y-4"> | ||
| {/* Username */} | ||
| <div className="space-y-1.5"> | ||
| <Label htmlFor="username">Username</Label> | ||
| <div className="relative"> | ||
| <User className="absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" /> | ||
| <Input | ||
| id="username" | ||
| placeholder="Enter username" | ||
| value={username} | ||
| onChange={(e) => setUsername(e.target.value)} | ||
| className="pl-8" | ||
| required | ||
| /> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Password */} | ||
| <div className="space-y-1.5"> | ||
| <Label htmlFor="password">Password</Label> | ||
| <div className="relative"> | ||
| <Lock className="absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" /> | ||
| <Input | ||
| id="password" | ||
| type={showPassword ? 'text' : 'password'} | ||
| placeholder="Enter password" | ||
| value={password} | ||
| onChange={(e) => setPassword(e.target.value)} | ||
| className="pl-8 pr-9" | ||
| required | ||
| /> | ||
| <button | ||
| type="button" | ||
| onClick={() => setShowPassword((v) => !v)} | ||
| className="absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors" | ||
| tabIndex={-1} | ||
|
Flashl3opard marked this conversation as resolved.
Resolved
|
||
| > | ||
| {showPassword ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />} | ||
| </button> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Tenant */} | ||
| <div className="space-y-1.5"> | ||
| <Label htmlFor="tenant">Tenant</Label> | ||
| <Select value={tenant} onValueChange={setTenant} required> | ||
| <SelectTrigger id="tenant" className="w-full"> | ||
| <SelectValue placeholder="Select tenant" /> | ||
| </SelectTrigger> | ||
| <SelectContent> | ||
| {TENANTS.map((t) => ( | ||
| <SelectItem key={t} value={t}> | ||
| {t} | ||
| </SelectItem> | ||
| ))} | ||
| </SelectContent> | ||
| </Select> | ||
| </div> | ||
|
|
||
| {/* Remember me */} | ||
| <div className="flex items-center gap-2"> | ||
| <Checkbox | ||
| id="rememberMe" | ||
| checked={rememberMe} | ||
| onCheckedChange={(v) => setRememberMe(Boolean(v))} | ||
| /> | ||
| <Label htmlFor="rememberMe" className="font-normal cursor-pointer"> | ||
| Remember me | ||
| </Label> | ||
| </div> | ||
|
|
||
| {/* Submit */} | ||
| <Button | ||
| type="submit" | ||
| className="w-full bg-[#1565C0] hover:bg-[#0d47a1] text-white" | ||
| > | ||
| Sign In | ||
| </Button> | ||
| </form> | ||
|
|
||
| {/* Footer */} | ||
| <p className="text-center text-xs text-muted-foreground"> | ||
| Powered by Mifos Initiative | ||
| </p> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.