Skip to content

Commit

Permalink
Merge pull request #171 from blockful-io/168-feat-manage-subdomains-flow
Browse files Browse the repository at this point in the history
168 feat manage subdomains flow
  • Loading branch information
eduramme authored Sep 5, 2024
2 parents 75223d7 + 299b566 commit a488062
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
31 changes: 15 additions & 16 deletions components/02-molecules/edit/FieldsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { createContext, useContext, useState, ReactNode } from "react";
import { isAddress } from "viem";
import _ from "lodash";
import validateBitcoinAddress from "bitcoin-address-validation";
import { DomainData, TextRecords } from "@/lib/domain-page";
import { DomainData } from "@/lib/domain-page";

interface FieldsContextType {
profileFields: Field[];
Expand Down Expand Up @@ -320,13 +320,10 @@ const FieldsProvider: React.FC<FieldsProviderProps> = ({ children }) => {

// Update profile fields with corresponding text values
const newProfileFields: Field[] = profileFields.map((field) => {
if (textsKeys.includes(field.label)) {
return {
...field,
value: String(texts[field.label]),
};
}
return field;
return {
...field,
value: String(texts[field.label] ?? ""),
};
});

// Get the names of the coins from the addresses, or an empty array if no addresses exist
Expand All @@ -351,22 +348,24 @@ const FieldsProvider: React.FC<FieldsProviderProps> = ({ children }) => {
};
}

return addressField; // Return the address field unchanged if no match is found
return {
...addressField,
value: "",
}; // Return the address field unchanged if no match is found
});
const newAccountsFields = accountsFields.map((field) => {
if (textsKeys.includes(field.label)) {
return {
...field,
value: String(texts[field.label]),
};
}
return field;
return {
...field,
value: String(texts[field.label] ?? ""),
};
});

const newFieldsByTab = {
[Tab.Profile]: newProfileFields,
[Tab.Accounts]: newAccountsFields,
[Tab.Addresses]: populatedAddressFields,
};

[Tab.Profile, Tab.Accounts, Tab.Addresses].forEach((tab) => {
setFields(tab, newFieldsByTab[tab]);
setInitialFields(tab, newFieldsByTab[tab]);
Expand Down
12 changes: 7 additions & 5 deletions components/organisms/ProfileTabBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,13 @@ export const ProfileTabBody = ({ domainData }: ProfileTabProps) => {
)}
</Skeleton>
<Skeleton>
<ProfileRecordItem
icon={EthTransparentSVG}
label="parent"
text="ETH"
/>
{domainData?.parent && (
<ProfileRecordItem
icon={EthTransparentSVG}
label="parent"
text={domainData.parent}
/>
)}
</Skeleton>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion components/organisms/SubdomainsTabBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const SubdomainsTabBody = ({
<Skeleton>
{subdomainsArray?.length ? (
<Table
clickable={false}
title="Names"
names={subdomainsArray}
withRoleColumn={false}
Expand Down
2 changes: 1 addition & 1 deletion pages/domains/[name]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function ManageNamePageContent({ name }: { name: string }) {

useEffect(() => {
handleFetchENSDomainData();
}, []);
}, [name]);

if (!ensData && error) {
return (
Expand Down

0 comments on commit a488062

Please sign in to comment.