Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Polish staff token entry UI

Neeraj Guptab8b0ed0807d4
diff --git a/infra/staff/src/App.css b/infra/staff/src/App.css
index ce33fda593..5a46137749 100644
--- a/infra/staff/src/App.css
+++ b/infra/staff/src/App.css
@@ -10,15 +10,46 @@
}
.token-entry {
- width: 408px;
- max-width: 100vw;
+ width: 100vw;
+ max-width: none;
+ min-height: 100svh;
justify-content: center;
padding: 24px;
box-sizing: border-box;
+ background-color: light-dark(#f7faf8, #1c211e);
+}
+
+.token-entry-card {
+ width: min(100%, 440px);
+ padding: 36px;
+ box-sizing: border-box;
+ border: 1px solid light-dark(#e1e9e3, #39443d);
+ border-radius: 18px;
+ background-color: light-dark(#ffffff, #292f2b);
+ box-shadow: 0 16px 48px light-dark(rgb(29 73 44 / 8%), rgb(0 0 0 / 20%));
+}
+
+.token-entry-image {
+ display: block;
+ width: 96px;
+ height: auto;
+ margin: 0 auto 12px;
+}
+
+.token-entry h1 {
+ margin: 0 0 8px;
+ font-size: 36px;
}
.token-entry p {
- margin-top: 0;
+ margin: 0;
+ color: light-dark(#596860, #c0cac2);
+ line-height: 1.5;
+}
+
+.token-entry .token-entry-hint {
+ margin-top: 20px;
+ font-size: 13px;
}
.token-form {
@@ -30,12 +61,55 @@
margin: 8px auto;
}
+.token-entry .token-form {
+ max-width: none;
+ margin-top: 28px;
+}
+
+.token-entry .MuiInputLabel-root,
+.token-entry .MuiOutlinedInput-root {
+ color: inherit;
+}
+
+.token-entry .MuiInputAdornment-root,
+.token-entry .MuiInputAdornment-root .MuiIconButton-root {
+ color: inherit;
+}
+
+.token-entry .MuiOutlinedInput-notchedOutline {
+ border-color: light-dark(#cbd7ce, #637067);
+}
+
+.token-entry .MuiInputLabel-root.Mui-focused {
+ color: #168f40;
+}
+
+.token-entry
+ .MuiOutlinedInput-root.Mui-focused
+ .MuiOutlinedInput-notchedOutline {
+ border-color: #1db954;
+}
+
.token-form-actions {
display: flex;
justify-content: flex-end;
gap: 8px;
}
+.token-entry .token-form-actions .token-submit-button {
+ width: 100%;
+ height: 48px;
+}
+
+.token-submit-button.MuiButton-contained {
+ color: white;
+ background-color: #1db954;
+}
+
+.token-submit-button.MuiButton-contained:hover {
+ background-color: #00b33c;
+}
+
.input-form {
display: flex;
flex-direction: column;
@@ -153,11 +227,30 @@
font-weight: bold;
}
-.empty-state-image {
- margin-top: 150px;
+.empty-state {
+ margin-top: 120px;
+ padding: 0 24px;
+}
+
+.empty-state h2 {
+ margin: 16px 0 6px;
+ font-size: 20px;
+}
+
+.empty-state p {
+ margin: 0;
+ color: light-dark(#596860, #c0cac2);
}
@media screen and (max-width: 475px) {
+ .token-entry-card {
+ padding: 28px 24px;
+ }
+
+ .token-entry h1 {
+ font-size: 32px;
+ }
+
.link-text {
font-size: 30px;
text-align: center;
diff --git a/infra/staff/src/App.tsx b/infra/staff/src/App.tsx
index e4bd047793..9a9955a54f 100644
--- a/infra/staff/src/App.tsx
+++ b/infra/staff/src/App.tsx
@@ -1,4 +1,6 @@
import MoreVertIcon from "@mui/icons-material/MoreVert";
+import VisibilityIcon from "@mui/icons-material/Visibility";
+import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
import {
Box,
Button,
@@ -7,6 +9,7 @@ import {
DialogContent,
DialogTitle,
IconButton,
+ InputAdornment,
Menu,
MenuItem,
Tab,
@@ -48,6 +51,7 @@ export const App: React.FC = () => {
() => urlCredentials.token ?? localStorage.getItem("token") ?? "",
);
const [tokenInput, setTokenInput] = useState("");
+ const [showToken, setShowToken] = useState(false);
const [tokenDialogOpen, setTokenDialogOpen] = useState(false);
const [tokenMenuAnchor, setTokenMenuAnchor] = useState<HTMLElement | null>(
null,
@@ -227,14 +231,36 @@ export const App: React.FC = () => {
const tokenForm = (
<form className="token-form" onSubmit={handleTokenSubmit}>
<TextField
- label="Staff token"
- type="password"
+ label="Token"
+ type={showToken ? "text" : "password"}
value={tokenInput}
onChange={(event) => setTokenInput(event.target.value)}
autoComplete="off"
autoFocus
required
fullWidth
+ slotProps={{
+ input: {
+ endAdornment: (
+ <InputAdornment position="end">
+ <IconButton
+ type="button"
+ aria-label={
+ showToken ? "Hide token" : "Show token"
+ }
+ onClick={() => setShowToken(!showToken)}
+ edge="end"
+ >
+ {showToken ? (
+ <VisibilityOffIcon />
+ ) : (
+ <VisibilityIcon />
+ )}
+ </IconButton>
+ </InputAdornment>
+ ),
+ },
+ }}
/>
<div className="token-form-actions">
{authToken && (
@@ -242,7 +268,11 @@ export const App: React.FC = () => {
Cancel
</Button>
)}
- <Button type="submit" variant="contained">
+ <Button
+ type="submit"
+ variant="contained"
+ className="token-submit-button"
+ >
{authToken ? "Update token" : "Continue"}
</Button>
</div>
@@ -251,11 +281,22 @@ export const App: React.FC = () => {
if (!authToken) {
return (
- <div className="container token-entry">
- <h1>Ente Staff</h1>
- <p>Enter your staff token to continue.</p>
- {tokenForm}
- </div>
+ <main className="container token-entry">
+ <section className="token-entry-card">
+ <img
+ src={duckieimage}
+ alt=""
+ className="token-entry-image"
+ />
+ <h1>Ente Staff</h1>
+ <p>Enter your token to continue.</p>
+ {tokenForm}
+ <p className="token-entry-hint">
+ The token is saved in this browser. You can update or
+ remove it later from the menu.
+ </p>
+ </section>
+ </main>
);
}
@@ -325,6 +366,7 @@ export const App: React.FC = () => {
onClick={() => {
setTokenMenuAnchor(null);
setTokenInput("");
+ setShowToken(false);
setTokenDialogOpen(true);
}}
>
@@ -418,11 +460,14 @@ export const App: React.FC = () => {
)}
</>
) : (
- <img
- src={duckieimage}
- alt="duckie"
- className="empty-state-image"
- />
+ <div className="empty-state">
+ <img src={duckieimage} alt="" />
+ <h2>Find an account</h2>
+ <p>
+ Enter an email address or user ID above to view
+ account details.
+ </p>
+ </div>
)}
</div>
<Dialog
@@ -431,7 +476,7 @@ export const App: React.FC = () => {
fullWidth
maxWidth="xs"
>
- <DialogTitle>Update staff token</DialogTitle>
+ <DialogTitle>Update token</DialogTitle>
<DialogContent>{tokenForm}</DialogContent>
</Dialog>
</div>