Skip to content

Commit

Permalink
fix(idea/frontend): dns ux (#1619)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitayutanov authored Aug 15, 2024
1 parent d7826a0 commit 6238947
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 105 deletions.
1 change: 1 addition & 0 deletions idea/frontend/src/features/dns/hooks/use-dns-filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function useDnsFilters() {
return owner === 'all' ? {} : { createdBy: decodedAddress };
};

// eslint-disable-next-line react-hooks/exhaustive-deps
const params = useMemo(() => ({ ...getOwnerParams(), orderByField, orderByDirection }), [values, account]);

return [values, params, setValues] as const;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useAccount, useAlert, usePrepareProgramTransaction, useProgram } from '@gear-js/react-hooks';
import { useAccount, useAlert, useBalanceFormat, usePrepareProgramTransaction, useProgram } from '@gear-js/react-hooks';
import { useQuery } from '@tanstack/react-query';

import { Method } from '@/features/explorer';
Expand All @@ -15,6 +15,7 @@ type FunctionName = typeof FUNCTION_NAME[keyof typeof FUNCTION_NAME];

const useSendDnsTransaction = <T extends FunctionName>(functionName: T) => {
const { account } = useAccount();
const { getFormattedBalance } = useBalanceFormat();
const alert = useAlert();

const [isLoading, enableLoading, disableLoading] = useLoading();
Expand Down Expand Up @@ -43,9 +44,10 @@ const useSendDnsTransaction = <T extends FunctionName>(functionName: T) => {

try {
const { transaction, awaited } = await prepareTransactionAsync({ args });
const formattedFee = getFormattedBalance(awaited.fee.toString());

showModal('transaction', {
fee: awaited.fee.toString(),
fee: `${formattedFee.value} ${formattedFee.unit}`,
name: TransactionName.SendMessage,
addressFrom: account.address,
addressTo: id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Props = {
function RemoveAdmin({ name, address, onSuccess }: Props) {
const [isModalOpen, openModal, closeModal] = useModalState();

const { sendTransaction } = useSendDnsTransaction(FUNCTION_NAME.REMOVE_ADMIN);
const { sendTransaction, isLoading } = useSendDnsTransaction(FUNCTION_NAME.REMOVE_ADMIN);

const handleSubmit = () => {
const _onSuccess = () => {
Expand All @@ -43,6 +43,7 @@ function RemoveAdmin({ name, address, onSuccess }: Props) {
)} will be removed. Would you like to proceed?`}
onSubmit={handleSubmit}
close={closeModal}
isLoading={isLoading}
/>
)}
</>
Expand Down
4 changes: 0 additions & 4 deletions idea/frontend/src/features/sortBy/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions idea/frontend/src/features/sortBy/model/consts.ts

This file was deleted.

43 changes: 0 additions & 43 deletions idea/frontend/src/features/sortBy/ui/SortBy.module.scss

This file was deleted.

47 changes: 0 additions & 47 deletions idea/frontend/src/features/sortBy/ui/SortBy.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion idea/frontend/src/pages/dns/dns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Dns = () => {
<Filters initialValues={filterValues} onSubmit={handleFiltersSubmit} title="Sort & Filter">
<FilterGroup name="orderByDirection" onSubmit={handleFiltersSubmit}>
<Radio name="orderByDirection" value="DESC" label="Newest first" onSubmit={handleFiltersSubmit} />
{account && <Radio name="orderByDirection" value="ASC" label="Oldest first" onSubmit={handleFiltersSubmit} />}
<Radio name="orderByDirection" value="ASC" label="Oldest first" onSubmit={handleFiltersSubmit} />
</FilterGroup>

<FilterGroup name="owner" onSubmit={handleFiltersSubmit} title="dDNS ownership">
Expand Down

This file was deleted.

0 comments on commit 6238947

Please sign in to comment.