Skip to content

Commit 283aa6c

Browse files
Show User ID on Account page (#17956)
* Show User ID on Account page * Move under other inputs
1 parent 20164cb commit 283aa6c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

components/dashboard/src/user-settings/Account.tsx

+13-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Alert from "../components/Alert";
1616
import { TextInputField } from "../components/forms/TextInputField";
1717
import isEmail from "validator/lib/isEmail";
1818
import { useToast } from "../components/toasts/Toasts";
19+
import { InputWithCopy } from "../components/InputWithCopy";
1920

2021
export default function Account() {
2122
const { user, setUser } = useContext(UserContext);
@@ -103,6 +104,7 @@ export default function Account() {
103104
}}
104105
errorMessage={errorMessage}
105106
emailIsReadonly={!canUpdateEmail}
107+
user={user}
106108
>
107109
<div className="flex flex-row mt-8">
108110
<Button htmlType="submit">Update Profile</Button>
@@ -126,6 +128,7 @@ function ProfileInformation(props: {
126128
setProfileState: (newState: User.Profile) => void;
127129
errorMessage: string;
128130
emailIsReadonly?: boolean;
131+
user?: User;
129132
children?: React.ReactChild[] | React.ReactChild;
130133
}) {
131134
return (
@@ -141,7 +144,7 @@ function ProfileInformation(props: {
141144
</Alert>
142145
)}
143146
<div className="flex flex-col lg:flex-row">
144-
<div>
147+
<fieldset>
145148
<TextInputField
146149
label="Name"
147150
value={props.profileState.name}
@@ -155,7 +158,15 @@ function ProfileInformation(props: {
155158
props.setProfileState({ ...props.profileState, email: val });
156159
}}
157160
/>
158-
</div>
161+
{props.user && (
162+
<div className="flex flex-col space-y-2 mt-4">
163+
<label className={"text-md font-semibold dark:text-gray-400 text-gray-600"}>User ID</label>
164+
<p className={"text-sm text-gray-500 dark:text-gray-500"}>
165+
<InputWithCopy className="max-w-md w-32" value={props.user.id} tip="Copy Token" />
166+
</p>
167+
</div>
168+
)}
169+
</fieldset>
159170
<div className="lg:pl-14">
160171
<div className="mt-4">
161172
<Subheading>Avatar</Subheading>

0 commit comments

Comments
 (0)