Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release primary name workflow fixes #649

Merged
merged 5 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 59 additions & 55 deletions src/components/data-display/tables/DomainsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -418,65 +418,69 @@ const DomainsTable = ({
return (
<div className="flex justify-end w-full">
<span className="flex pr-3 w-fit gap-3">
<Tooltip
message={
!antHandlers?.includes('approvePrimaryName') ||
!antHandlers?.includes('removePrimaryNames')
? 'Update ANT to access Primary Names workflow'
: primaryNameData?.name === row.getValue('name')
? 'Remove Primary Name'
: 'Set Primary Name'
}
icon={
<button
disabled={
!antHandlers?.includes('approvePrimaryName') ||
!antHandlers?.includes('removePrimaryNames')
}
onClick={() => {
const targetName = row.getValue('name') as string;
if (primaryNameData?.name === targetName) {
// remove primary name payload
dispatchTransactionState({
type: 'setTransactionData',
payload: {
names: [targetName],
arioProcessId,
assetId: row.getValue('processId'),
functionName: 'removePrimaryNames',
},
});
} else {
dispatchTransactionState({
type: 'setTransactionData',
payload: {
name: targetName,
arioProcessId,
assetId: arioProcessId,
functionName: 'primaryNameRequest',
},
});
{row.getValue('role') === 'owner' ? (
<Tooltip
message={
!antHandlers?.includes('approvePrimaryName') ||
!antHandlers?.includes('removePrimaryNames')
? 'Update ANT to access Primary Names workflow'
: primaryNameData?.name === row.getValue('name')
? 'Remove Primary Name'
: 'Set Primary Name'
}
icon={
<button
disabled={
!antHandlers?.includes('approvePrimaryName') ||
!antHandlers?.includes('removePrimaryNames')
}
onClick={() => {
const targetName = row.getValue('name') as string;
if (primaryNameData?.name === targetName) {
// remove primary name payload
dispatchTransactionState({
type: 'setTransactionData',
payload: {
names: [targetName],
arioProcessId,
assetId: row.getValue('processId'),
functionName: 'removePrimaryNames',
},
});
} else {
dispatchTransactionState({
type: 'setTransactionData',
payload: {
name: targetName,
arioProcessId,
assetId: arioProcessId,
functionName: 'primaryNameRequest',
},
});
}

dispatchModalState({
type: 'setModalOpen',
payload: { showPrimaryNameModal: true },
});
}}
>
<Star
className={
(row.getValue('name') == primaryNameData?.name
? 'text-primary fill-primary'
: 'text-grey') +
`
dispatchModalState({
type: 'setModalOpen',
payload: { showPrimaryNameModal: true },
});
}}
>
<Star
className={
(row.getValue('name') == primaryNameData?.name
? 'text-primary fill-primary'
: 'text-grey') +
`
w-[18px]
`
}
/>
</button>
}
/>
}
/>
</button>
}
/>
) : (
<></>
)}
<ManageAssetButtons
id={lowerCaseDomain(row.getValue('name') as string)}
assetType="names"
Expand Down
6 changes: 5 additions & 1 deletion src/components/pages/ManageDomain/ManageDomain.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import TransactionSuccessCard from '@src/components/cards/TransactionSuccessCard/TransactionSuccessCard';
import { AntLogoIcon } from '@src/components/data-display/AntLogoIcon';
import DomainSettings from '@src/components/forms/DomainSettings/DomainSettings';
import useDomainInfo from '@src/hooks/useDomainInfo';
import { usePrimaryName } from '@src/hooks/usePrimaryName';
import { useGlobalState, useModalState, useWalletState } from '@src/state';
import { useTransactionState } from '@src/state/contexts/TransactionState';
Expand All @@ -19,9 +20,12 @@ function ManageDomain() {
useTransactionState();
const [, dispatchModalState] = useModalState();
const { data: primaryNameData } = usePrimaryName();
const { data: domainData } = useDomainInfo({ domain: name });
const [{ walletAddress }] = useWalletState();

const isOwner = walletAddress?.toString() === primaryNameData?.owner;
const isOwner = walletAddress
? walletAddress.toString() === domainData?.info?.Owner
: false;

const [logoId, setLogoId] = useState<string | undefined>();

Expand Down
Loading