Skip to content

Commit 573a1a2

Browse files
committed
refactor: simplify Settings component
1 parent 4b9dc11 commit 573a1a2

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

web/src/components/RegistryCard/RegistryInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const ListInfo: React.FC<IListInfo> = ({ title, totalItems, logoURI, status, isL
3535
className={cn(
3636
"flex flex-col justify-center items-center gap-2 h-[calc(100%-45px)]",
3737
isListView && [
38-
"grid grid-cols-[21px_max.content_1fr_max-content] grid-rows-[repeat(3,min-content)] gap-y-4",
38+
"grid grid-cols-[21px_max-content_1fr_max-content] grid-rows-[repeat(3,min-content)] gap-y-4",
3939
"w-full h-max lg:h-16 p-4",
4040
"[&_h3]:col-span-4 [&_img]:col-span-4",
4141
"lg:justify-between lg:grid-rows-[1fr] lg:px-8",

web/src/layout/Header/navbar/Menu/Settings/index.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,31 @@ import clsx from "clsx";
1010
const TABS = [
1111
{
1212
id: 0,
13+
value: 0,
1314
text: "General",
15+
content: null,
1416
},
1517
{
1618
id: 1,
19+
value: 1,
1720
text: "Notifications",
21+
content: null,
1822
},
1923
];
2024

2125
const inlinePaddingCalc = "calc(8px+(32-8)*((100vw-300px)/(1250-300)))";
2226
const widthCalc = "calc(300px+(424-300)*((100vw-300px)/(1250-300)))";
2327

24-
const Settings: React.FC<ISettings> = ({ toggleIsSettingsOpen, initialTab }) => {
25-
const [currentTab, setCurrentTab] = useState<number>(initialTab || 0);
28+
const Settings: React.FC<ISettings> = ({ toggleIsSettingsOpen }) => {
29+
const [currentTab, setCurrentTab] = useState<number>(0);
2630
const containerRef = useRef(null);
2731
const location = useLocation();
2832
const navigate = useNavigate();
2933
useClickAway(containerRef, () => {
3034
toggleIsSettingsOpen();
3135
if (location.hash.includes("#notifications")) navigate("#", { replace: true });
3236
});
37+
3338
return (
3439
<div
3540
ref={containerRef}
@@ -42,10 +47,9 @@ const Settings: React.FC<ISettings> = ({ toggleIsSettingsOpen, initialTab }) =>
4247
<div className="flex justify-center text-2xl mt-6 text-klerosUIComponentsPrimaryText">Settings</div>
4348
<Tabs
4449
className={clsx(`py-0 px-[${inlinePaddingCalc}]`, `max-w-[660px] w-[86vw] lg:w-[${widthCalc}]`)}
45-
currentValue={currentTab}
4650
items={TABS}
47-
callback={(n: number) => {
48-
setCurrentTab(n);
51+
callback={(_, value: number) => {
52+
setCurrentTab(value);
4953
}}
5054
/>
5155
{currentTab === 0 ? <General /> : <NotificationSettings {...{ toggleIsSettingsOpen }} />}

0 commit comments

Comments
 (0)