Skip to content

Commit

Permalink
Merge pull request #140 from supertokens/ui/fixes
Browse files Browse the repository at this point in the history
fix: Dashboard login methods issues and search UI
  • Loading branch information
rishabhpoddar authored Mar 19, 2024
2 parents 4df11c4 + edb88fb commit 3b25a24
Show file tree
Hide file tree
Showing 19 changed files with 138 additions and 117 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.10.5] - 2024-03-19

- Fixes UI bugs on search and Login methods section in userDetails page.

## [0.10.4] - 2024-03-08

- Improves UX when deleting a user from the dashboard.
Expand Down
4 changes: 2 additions & 2 deletions build/static/css/main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/static/css/main.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/static/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/static/js/bundle.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dashboard",
"version": "0.10.4",
"version": "0.10.5",
"private": true,
"dependencies": {
"@babel/core": "^7.16.0",
Expand Down
1 change: 1 addition & 0 deletions src/ui/components/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
border-radius: 6px;
font-family: inherit;
line-height: 21px;
flex-shrink: 0;

cursor: pointer;

Expand Down
5 changes: 5 additions & 0 deletions src/ui/components/copyText/CopyText.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
max-width: 100%;
.copy-text-text {
@include text-ellipsis(100%);
max-width: 180px;
flex: 1;
padding-right: 4px;

@media (max-width: 600px) {
max-width: 80px;
}
}
.copy-text-action {
cursor: pointer;
Expand Down
8 changes: 6 additions & 2 deletions src/ui/components/phoneNumber/PhoneNumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const PhoneNumberTextField: FC<PhoneNumberTextFieldProps> = forwardRef(
PhoneNumberTextField.displayName = "PhoneNumberTextField";

export const PhoneNumberInput: FC<PhoneNumberInputProps> = (props: PhoneNumberInputProps) => {
const { onChange, value, error, forceShowError } = props;
const { onChange, value, error, forceShowError, disabled } = props;
const [isTouched, setIsTouched] = useState(false);

// call the `onChange` and set form as touched
Expand All @@ -252,13 +252,17 @@ export const PhoneNumberInput: FC<PhoneNumberInputProps> = (props: PhoneNumberIn
);

return (
<div>
<div
style={{
pointerEvents: disabled ? "none" : "all",
}}>
<label htmlFor={props.name}>{props.label}</label>
<PhoneInputWithCountrySelect
className={`phone-input ${error !== undefined ? "phone-input-error" : ""}`}
value={value}
onChange={handleChange}
international={true}
focusInputOnCountrySelection={false}
addInternationalOption={false}
withCountryCallingCode={false}
countryCallingCodeEditable={true}
Expand Down
30 changes: 17 additions & 13 deletions src/ui/components/search/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
& > div {
display: flex;
align-items: center;
gap: 8px;
gap: 0px 8px;
flex-wrap: wrap;

@media (max-width: 480px) {
& {
gap: 8px 8px;
}
& > button {
width: 100%;
}
}
}
#search-btn {
background: transparent;
justify-content: center;
@media screen and (max-width: 768px) {
& {
width: 30%;
margin-left: 0;
}
}
}

&__input_wrapper {
Expand All @@ -26,12 +30,6 @@
border: 1px solid #e5e5e5;
border-radius: 6px;

@media screen and (max-width: 768px) {
& {
width: 100%;
}
}

& img {
height: 14px;
aspect-ratio: 1;
Expand Down Expand Up @@ -73,6 +71,12 @@
padding-bottom: 0;
}
}

@media (max-width: 480px) {
& {
width: 100%;
}
}
}

@media (max-width: 486px) {
Expand Down
14 changes: 3 additions & 11 deletions src/ui/components/userDetail/loginMethods/LoginMethods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ const Methods: React.FC<MethodProps> = ({
const [emailError, setEmailError] = useState("");
const { getUserEmailVerificationStatus } = useVerifyUserEmail();

const trim = (val: string) => {
const len = val.length;
return val.substring(0, Math.floor(len / 7)) + "..." + val.substring(6 * Math.floor(len / 7), len);
};

const sendUserEmailVerification = useCallback(
async (userId: string, tenantId: string | undefined) => {
const res = await getUserEmailVerificationStatus(userId);
Expand Down Expand Up @@ -245,11 +240,8 @@ const Methods: React.FC<MethodProps> = ({
<UserRecipePill {...loginMethod} />
<span className="user-id-span">
User ID:
<span className="copy-text-wrapper resp">
<CopyText copyVal={loginMethod.recipeUserId}>{trim(loginMethod.recipeUserId)}</CopyText>
</span>
<span className="copy-text-wrapper">
<CopyText>{loginMethod.recipeUserId}</CopyText>
<CopyText copyVal={loginMethod.recipeUserId}>{loginMethod.recipeUserId}</CopyText>
</span>
</span>
</div>
Expand Down Expand Up @@ -285,7 +277,7 @@ const Methods: React.FC<MethodProps> = ({
<div>
<EditableInput
label={"Email ID"}
val={loginMethod.email ?? ""}
val={send.email ?? ""}
edit={loginMethod.recipeId === "thirdparty" ? false : isEditing}
type={"email"}
error={emailError}
Expand Down Expand Up @@ -340,7 +332,7 @@ const Methods: React.FC<MethodProps> = ({
<div>
<EditableInput
label={"Phone Number"}
val={loginMethod.phoneNumber ?? ""}
val={send.phone ?? ""}
edit={isEditing}
type={"phone"}
onChange={(val) => setSend({ ...send, phone: val })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
display: flex;
justify-content: flex-start;
align-items: baseline;

@media (max-width: 340px) {
flex-direction: column;
}
}

.input-field-container {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { useEffect, useState } from "react";
import InputField from "../../../inputField/InputField";
import "./editableInput.scss";
import { PhoneNumberInput } from "../../../phoneNumber/PhoneNumberInput";
import phoneNumber from "../../../phoneNumber/PhoneNumber";
import "./editableInput.scss";

export type EditableInputProps = {
label: string;
Expand All @@ -14,35 +12,29 @@ export type EditableInputProps = {
};

export const EditableInput = ({ label, val, edit, type, onChange, error }: EditableInputProps) => {
if (!edit) {
return (
<span>
{label}:<b>{val == "" ? "-" : val}</b>
</span>
);
} else {
return (
<span className="input">
{label}:&nbsp;{" "}
{type === "email" && (
<InputField
type="email"
name="email"
error={error ?? ""}
value={val}
handleChange={({ target }) => {
onChange(target.value);
}}
/>
)}
{type === "phone" && (
<PhoneNumberInput
value={val}
name="Phone Number"
onChange={onChange}
/>
)}
</span>
);
}
return (
<span className="input">
{label}:&nbsp;{" "}
{type === "email" && (
<InputField
disabled={!edit}
type="email"
name="email"
error={error ?? ""}
value={val}
handleChange={({ target }) => {
onChange(target.value);
}}
/>
)}
{type === "phone" && (
<PhoneNumberInput
disabled={!edit}
value={val}
name="Phone Number"
onChange={onChange}
/>
)}
</span>
);
};
39 changes: 20 additions & 19 deletions src/ui/components/userDetail/loginMethods/loginMethods.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
align-items: baseline;
justify-content: space-between;

.right {
display: flex;
gap: 4px;
}

.left {
display: flex;
align-items: baseline;
Expand All @@ -25,13 +30,17 @@
margin-left: 15px;
color: #6e6a65;

display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;

.copy-text-wrapper {
border-radius: 3px;
border: 1px solid #d9d9d9;
color: #d65078;
font-size: 13px;
padding: 5px;
margin-left: 10px;
}
}

Expand All @@ -41,15 +50,12 @@

@media screen and (max-width: 900px) {
gap: 14px;
flex-direction: column;
.user-id-span {
margin-left: 0;

.copy-text-wrapper {
display: none;
}
.copy-text-wrapper.resp {
display: inline-block;
margin-left: 0;
}
}
}
Expand All @@ -62,7 +68,7 @@
grid-template-columns: 1fr 1fr;
gap: 10px;

@media screen and (max-width: 900px) {
@media screen and (max-width: 800px) {
grid-template-columns: 1fr;
}

Expand All @@ -74,10 +80,10 @@
display: flex;
align-items: center;
height: 50px;
}

@media screen and (max-width: 900px) {
height: 37px;
}
.phone-input {
width: 200px !important;
}

b {
Expand Down Expand Up @@ -111,10 +117,6 @@
.method-body {
padding: 18px 8px;
}

.left {
flex-direction: column;
}
}
}

Expand Down Expand Up @@ -147,11 +149,12 @@
}

.not-verified {
border-radius: 22px;
border-radius: 16px;
border: 1px solid #d2d2d2;
background: #ececec;
font-size: 12px;
padding: 4px 10px;
font-size: 10px;
padding: 5px;

color: #252728;
text-align: center;
}
Expand All @@ -174,7 +177,6 @@

&:hover {
text-decoration: underline;
font-weight: 500;
}
}

Expand Down Expand Up @@ -208,7 +210,6 @@
}

.cancel {
margin: 0.25rem !important;
padding: 6px 12px !important;
padding: 7px 12px !important;
font-weight: 500;
}
Loading

0 comments on commit 3b25a24

Please sign in to comment.