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

Drop Manager Refactors and Keypom Rewrite #219

Merged
merged 8 commits into from
Feb 29, 2024
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
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions src/components/ProtectedRoutes/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
const navigate = useNavigate();

useEffect(() => {
console.log('isLoggedIn', isLoggedIn);

Check warning on line 18 in src/components/ProtectedRoutes/ProtectedRoute.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected console statement
if (!isLoggedIn) {
console.error('Unauthenticated page access.');

Check warning on line 20 in src/components/ProtectedRoutes/ProtectedRoute.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected console statement
navigate(redirectPath);
}
}, [isLoggedIn]);
Expand Down
4 changes: 4 additions & 0 deletions src/components/SignedInButton/SignedInButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
const { account, selector } = useAuthWalletContext();

const handleSignOut = async () => {
if (!selector.isSignedIn()) {
console.error('Not signed in');

Check warning on line 31 in src/components/SignedInButton/SignedInButton.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected console statement
return;
}
const wallet = await selector.wallet();

wallet
Expand All @@ -53,7 +57,7 @@
const amountInNEAR = formatNearAmount(account.amount, 4);

if (amountInNEAR === null) {
console.error('Account amount is null');

Check warning on line 60 in src/components/SignedInButton/SignedInButton.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected console statement
return 0;
}

Expand Down
17 changes: 13 additions & 4 deletions src/components/Table/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { type ColumnItem, type DataItem } from './types';
*/

interface DataTableProps extends TableProps {
type?: 'all-drops' | 'drop-manager' | 'no-filtered-drops';
type?: 'all-drops' | 'drop-manager' | 'no-filtered-keys' | 'no-filtered-drops';
showColumns?: boolean;
columns: ColumnItem[];
data: DataItem[];
Expand Down Expand Up @@ -98,12 +98,21 @@ export const DataTable = ({
{/* Desktop Table */}
<Show above="md">
<TableContainer>
<Table {...props}>
<Table {...props} borderRadius="12px">
{showColumns && (
<Thead>
<Tr>
{columns.map((col) => (
<Th key={col.id} fontFamily="body" {...col.thProps}>
{columns.map((col, index) => (
<Th
key={col.id}
fontFamily="body"
{...col.thProps}
// Apply a border radius of 12px to the first and last Th elements
borderTopLeftRadius={index === 0 ? '12px !important' : undefined}
borderTopRightRadius={
index === columns.length - 1 ? '12px !important' : undefined
}
>
{col.title}
</Th>
))}
Expand Down
8 changes: 5 additions & 3 deletions src/components/Table/MobileDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const MobileDataTable = ({
));
}

return data.map((drop) => (
return data.map((drop, idx) => (
<Tr
key={drop.id}
_hover={
Expand Down Expand Up @@ -69,14 +69,16 @@ export const MobileDataTable = ({
))}
</VStack>
</Td>
<Td verticalAlign="middle">{actionColumn.selector(drop)}</Td>
<Td textAlign="end" verticalAlign="middle">
{actionColumn.selector(drop)}
</Td>
</Tr>
));
};

return (
<TableContainer whiteSpace="normal">
<Table {...props}>
<Table {...props} borderRadius="12px">
<Tbody>{getMobileTableBody()}</Tbody>
</Table>
</TableContainer>
Expand Down
4 changes: 4 additions & 0 deletions src/components/Table/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export const EMPTY_TABLE_TEXT_MAP = {
heading: `No drops found with the current filters`,
text: `Please try different filters`,
},
'no-filtered-keys': {
heading: `No keys found with the current filters`,
text: `Please try different filters`,
},
'drop-manager': {
heading: `You haven't added any keys`,
text: '',
Expand Down
2 changes: 1 addition & 1 deletion src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export const MASTER_KEY = 'MASTER_KEY';

export const MAX_FILE_SIZE = 10000000;

export const PAGE_SIZE_LIMIT = 10;
export const PAGE_SIZE_LIMIT = 5;
export const NFT_ATTEMPT_KEY = 'NFT_ATTEMPT';
export const PAGE_QUERY_PARAM = 'page';
2 changes: 1 addition & 1 deletion src/contexts/AuthWalletContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const AuthWalletContextProvider = ({ children }: PropsWithChildren) => {
selector: selector as WalletSelector,
accounts,
accountId,
isLoggedIn: Boolean(sessionStorage.getItem('account')), // selector?.isSignedIn(), with null, cant login. with undefined, cant signout properly
isLoggedIn: Boolean(selector ? selector.isSignedIn() : true), // selector?.isSignedIn(), with null, cant login. with undefined, cant signout properly
account: account as Account,
};

Expand Down
4 changes: 4 additions & 0 deletions src/custom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.png' {
const value: any;

Check warning on line 2 in src/custom.d.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type
export = value;
}
Loading
Loading