Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Refactor & Feat [Authentication page]
Browse files Browse the repository at this point in the history
Ref : 🚀 Client App [Tauri] (#27)
[+] refactor(auth.tsx): improve readability of resetAccessCode function
[+] feat(auth.tsx): add support for rendering input access token based on whether it's an app
H0llyW00dzZ committed Oct 5, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 3e73c23 commit 93e5514
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions app/components/auth.tsx
Original file line number Diff line number Diff line change
@@ -14,7 +14,10 @@ export function AuthPage() {
const access = useAccessStore();

const goHome = () => navigate(Path.Home);
const resetAccessCode = () => { access.updateCode(""); access.updateToken(""); }; // Reset access code to empty string
const resetAccessCode = () => { // refactor this for better readability of code
access.updateCode("");
access.updateToken("");
}; // Reset access code to empty string
const goPrivacy = () => navigate(Path.PrivacyPage);

return (
@@ -27,15 +30,27 @@ export function AuthPage() {
<div className={styles["auth-tips"]}>{Locale.Auth.Tips}</div>

{!getClientConfig()?.isApp && ( // Conditionally render the input access code based on whether it's an app
<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Auth.Input}
value={access.accessCode}
onChange={(e) => {
access.updateCode(e.currentTarget.value);
}}
/>
<>
<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Auth.Input}
value={access.accessCode}
onChange={(e) => {
access.updateCode(e.currentTarget.value);
}}
/>
<div className={styles["auth-tips"]}>{Locale.Auth.SubTips}</div>
<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Settings.Token.Placeholder}
value={access.token}
onChange={(e) => {
access.updateToken(e.currentTarget.value);
}}
/>
</>
)}

{getClientConfig()?.isApp && ( // Conditionally render the input access token based on whether it's an app

0 comments on commit 93e5514

Please sign in to comment.