-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from ASM-Studios/mra/feat-dashboard
Mra/feat dashboard
- Loading branch information
Showing
28 changed files
with
1,802 additions
and
196 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
File renamed without changes.
This file contains 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,54 @@ | ||
import { Form, Button } from 'antd'; | ||
import { GoogleOAuthProvider } from '@react-oauth/google'; | ||
// @ts-ignore | ||
import { uri } from '@Config/uri'; | ||
|
||
interface GoogleAuthProps { | ||
onSuccess: (response: unknown) => void; | ||
onError: () => void; | ||
buttonText: string; | ||
} | ||
|
||
const GoogleAuth = ({ onSuccess, onError, buttonText }: GoogleAuthProps) => { | ||
if (!uri.google.auth.clientId || uri.google.auth.clientId === '') { | ||
return null; | ||
} | ||
|
||
const handleGoogleLogin = () => { | ||
// Initialize the Google Sign-In client | ||
let google: any; | ||
const client = google.accounts.oauth2.initCodeClient({ | ||
client_id: uri.google.auth.clientId, | ||
scope: 'email profile', // TODO: Add other scopes as needed | ||
callback: (response: unknown) => { | ||
// @ts-ignore | ||
if (response?.code) { | ||
onSuccess(response); | ||
} else { | ||
onError(); | ||
} | ||
}, | ||
}); | ||
client.requestCode(); | ||
}; | ||
|
||
return ( | ||
<GoogleOAuthProvider clientId={uri.google.auth.clientId}> | ||
<Form.Item style={{ textAlign: 'center' }}> | ||
<Button | ||
onClick={handleGoogleLogin} | ||
className="w-full flex items-center justify-center gap-2 bg-white text-gray-700 py-2 px-4 rounded-md hover:bg-gray-100 transition-colors border border-gray-300" | ||
> | ||
<img | ||
src="/google-icon.png" | ||
alt="Google Logo" | ||
style={{ width: '24px', height: '24px' }} | ||
/> | ||
{buttonText} | ||
</Button> | ||
</Form.Item> | ||
</GoogleOAuthProvider> | ||
); | ||
}; | ||
|
||
export default GoogleAuth; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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,33 @@ | ||
import React from "react"; | ||
import { Button } from 'antd'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
interface LinkButtonProps { | ||
text: string; | ||
url?: string; | ||
style?: React.CSSProperties; | ||
type?: "primary" | "default" | "dashed" | "link" | "text" | "danger" | undefined; | ||
goBack?: boolean; | ||
} | ||
|
||
const LinkButton: React.FC<LinkButtonProps> = ({ text, url, type = "primary", style = {}, goBack = false }) => { | ||
const navigate = useNavigate(); | ||
|
||
const handleClick = () => { | ||
if (goBack) { | ||
navigate(-1); | ||
} else if (url) { | ||
navigate(url); | ||
} | ||
}; | ||
|
||
const buttonStyle = type === "danger" ? { ...style, backgroundColor: 'red', borderColor: 'red', color: 'white' } : style; | ||
|
||
return ( | ||
<Button type={type === "danger" ? "default" : type} style={buttonStyle} onClick={handleClick}> | ||
{text} | ||
</Button> | ||
); | ||
}; | ||
|
||
export default LinkButton; |
File renamed without changes.
This file contains 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 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
Oops, something went wrong.