generated from EasyWebApp/WebCell-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 7
Implement simplified Material UI login system with server-side JWT validation and configure @idea2app/data-server package integration #84
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 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c3391dd
Initial plan
Copilot 51fba97
Initial plan for SMS verification login system
Copilot eb83a59
Implement SMS verification login system with Material UI
Copilot a0af9b7
Complete SMS verification system with working API endpoints
Copilot e5d6eb2
Address review feedback: delete files, simplify components, update Us…
Copilot 42b8d42
Implement server-side JWT validation and add i18n translations
Copilot 26e37e6
Fix package-lock.json issue and address all review feedback
Copilot 039af9a
Merge remote-tracking branch 'origin/main' into copilot/fix-83
TechQuery ed3bae2
[fix] many GitHub copilot bugs
TechQuery a558d15
Fix i18n translations in SessionForm by using t() function properly
Copilot 0ce9f38
Configure @idea2app/data-server package access and update types
Copilot 96e9c9b
[fix] many GitHub copilot bugs
TechQuery 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
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
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,72 @@ | ||
| import { Drawer, List, ListItem, ListItemButton, ListItemText } from '@mui/material'; | ||
| import { observable } from 'mobx'; | ||
| import { observer } from 'mobx-react'; | ||
| import { Component, HTMLAttributes, JSX } from 'react'; | ||
|
|
||
| import { PageHead } from '../PageHead'; | ||
| import { SessionForm } from './SessionForm'; | ||
|
|
||
| export type MenuItem = Pick<JSX.IntrinsicElements['a'], 'href' | 'title'>; | ||
|
|
||
| export interface SessionBoxProps extends HTMLAttributes<HTMLDivElement> { | ||
| path?: string; | ||
| menu?: MenuItem[]; | ||
| jwtPayload?: any; // TODO: Define proper JWT payload type | ||
| } | ||
TechQuery marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @observer | ||
| export class SessionBox extends Component<SessionBoxProps> { | ||
| @observable | ||
| accessor modalShown = false; | ||
|
|
||
| componentDidMount() { | ||
| this.modalShown = !this.props.jwtPayload; | ||
| } | ||
|
|
||
| render() { | ||
| const { className = '', title, children, path, menu = [], jwtPayload, ...props } = this.props; | ||
|
|
||
| return ( | ||
| <div className={`flex ${className}`} {...props}> | ||
| <div> | ||
| <List | ||
| component="nav" | ||
| className="flex-col px-3 sticky-top" | ||
| style={{ top: '5rem', minWidth: '200px' }} | ||
| > | ||
| {menu.map(({ href, title }) => ( | ||
| <ListItem key={href} disablePadding> | ||
| <ListItemButton | ||
| href={href} | ||
| selected={path?.split('?')[0].startsWith(href!)} | ||
| className="rounded" | ||
| > | ||
| <ListItemText primary={title} /> | ||
| </ListItemButton> | ||
| </ListItem> | ||
| ))} | ||
| </List> | ||
| </div> | ||
| <main className="flex-1 pb-3"> | ||
| <PageHead title={title} /> | ||
|
|
||
| <h1 className="text-3xl font-bold mb-4">{title}</h1> | ||
|
|
||
| {children} | ||
|
|
||
| <Drawer | ||
| anchor="right" | ||
| open={this.modalShown} | ||
| onClose={() => (this.modalShown = false)} | ||
| PaperProps={{ | ||
| className: 'p-4', | ||
| style: { width: '400px' }, | ||
| }} | ||
| > | ||
| <SessionForm onSignIn={() => window.location.reload()} /> | ||
| </Drawer> | ||
| </main> | ||
| </div> | ||
| ); | ||
| } | ||
| } | ||
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.