Skip to content

Commit

Permalink
Merge pull request #204 from waldo-vision/feat/improve-dashboard-search
Browse files Browse the repository at this point in the history
feat(dash): improve search
  • Loading branch information
ceriddenn authored Apr 2, 2023
2 parents d5967dd + e6055b3 commit ac0841a
Show file tree
Hide file tree
Showing 19 changed files with 415 additions and 449 deletions.
516 changes: 258 additions & 258 deletions .yarn/releases/yarn-3.4.1.cjs → .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.4.1.cjs
yarnPath: .yarn/releases/yarn-3.5.0.cjs
3 changes: 1 addition & 2 deletions apps/web/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import Link from 'next/link';
import Image from 'next/image';
import { useRouter } from 'next/router';
import WaldoLogo from '../public/android-chrome-256x256.png';
import GithubLogo from '../public/navbar_github.png';
import { discord, docs, github, githubrepo } from '@utils/links';
import { discord, docs, github } from '@utils/links';
import useSite from '@site';
import BlacklistedModal from './BlacklistedModal';
export default function Navigation() {
Expand Down
2 changes: 2 additions & 0 deletions apps/web/components/TurnstileWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ const TurnstileWidget = (props: WidgetProps) => {
const ref = useRef(null);
useEffect(() => {
if (props.refreshState > 0) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
ref.current?.reset();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
ref.current?.render();
}
Expand Down
26 changes: 18 additions & 8 deletions apps/web/components/account/DeleteAccModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const DeleteAccModal = (props: Props) => {
const [showModal, setShowModal] = useState<boolean | null>(false);
const [userId, setUserId] = useState<string>();
const [loading, setLoading] = useState<boolean>(true);
const [deleteButtonLoading, setDeleteButtonLoading] = useState<boolean>(false);
const [deleteButtonLoading, setDeleteButtonLoading] =
useState<boolean>(false);
const { setSession } = useSite();
const router = useRouter();
const utils = trpc.useContext();
Expand All @@ -47,11 +48,11 @@ const DeleteAccModal = (props: Props) => {
const handleDelete = async () => {
if (!deleteButtonLoading) {
setDeleteButtonLoading(true);

await deleteUser.mutateAsync({ userId: userId as string });
setSession(null);

router.push("/");
router.push('/');
}
};
return (
Expand All @@ -78,17 +79,26 @@ const DeleteAccModal = (props: Props) => {
</Text>
</ModalBody>
<ModalFooter>
<Button colorScheme="red" mr={3} onClick={() => handleDelete()} disabled={deleteButtonLoading}>
<Button
colorScheme="red"
mr={3}
onClick={() => handleDelete()}
disabled={deleteButtonLoading}
>
{deleteButtonLoading ? (
<>
<Spinner color={"white"} size={'md'} />
&nbsp;Deleting...
<Spinner color={'white'} size={'md'} />
&nbsp;Deleting...
</>
) : (
"Delete Account"
'Delete Account'
)}
</Button>
<Button variant="ghost" onClick={() => setShowModal(false)} hidden={!!deleteButtonLoading}>
<Button
variant="ghost"
onClick={() => setShowModal(false)}
hidden={!!deleteButtonLoading}
>
Cancel
</Button>
</ModalFooter>
Expand Down
16 changes: 2 additions & 14 deletions apps/web/pages/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ export default function Account() {
>
You have linked <b>all</b> of the following accounts:
</Text>
{session?.user?.role == 'ADMIN' && (
{(session?.user?.role == 'ADMIN' ||
session?.user?.role == 'MOD') && (
<Text>
Redirect me to the{' '}
<chakra.span
Expand All @@ -210,19 +211,6 @@ export default function Account() {
</chakra.span>
</Text>
)}
{session?.user?.role == 'MOD' && (
<Text>
Redirect me to the{' '}
<chakra.span
fontWeight={'bold'}
textDecor={'underline'}
cursor={'pointer'}
onClick={() => router.push('/dash/user')}
>
Admin Dashboard
</chakra.span>
</Text>
)}
</Flex>
<Flex direction={'column'}>
{linkedAccounts &&
Expand Down
4 changes: 2 additions & 2 deletions apps/web/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ interface RedirectCallback {

const adapter = {
...PrismaAdapter(prisma),
linkAccount: ({ sub, ...data }: any) => prisma.account.create({ data })
} as Adapter
linkAccount: ({ sub, ...data }: any) => prisma.account.create({ data }),
} as Adapter;

export const authOptions = {
adapter,
Expand Down
20 changes: 10 additions & 10 deletions apps/web/pages/auth/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ export default function Login() {
});
};

const createErrorToast = (str: string) => {
toast({
position: 'bottom-right',
title: 'Error',
description: str,
status: 'error',
duration: 5000,
isClosable: true,
});
};
// const createErrorToast = (str: string) => {
// toast({
// position: 'bottom-right',
// title: 'Error',
// description: str,
// status: 'error',
// duration: 5000,
// isClosable: true,
// });
// };
const retrieveUserSession = async () => {
const session = await getSession();
setUserSession(session);
Expand Down
21 changes: 15 additions & 6 deletions apps/web/pages/dash/gameplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { unstable_getServerSession } from 'next-auth/next';
import { BiBlock } from 'react-icons/bi';
import { authOptions } from 'pages/api/auth/[...nextauth]';
import { games } from '@config/gameplay';
import { GameplayType, GameplayTypeWithNull } from '@utils/zod/gameplay';
type Query =
| {
gameplayCount?: number | undefined;
Expand Down Expand Up @@ -161,18 +162,26 @@ export default function Gameplay() {
</MenuButton>
<MenuList>
{games.map(game => {
return <MenuItem onClick={() => handleFilter(game.shortName.toUpperCase() as GameplayTypeWithNull)}>
{game.shortName.toUpperCase()}
</MenuItem>
return (
<MenuItem
onClick={() =>
handleFilter(
game.shortName.toUpperCase() as GameplayTypeWithNull,
)
}
>
{game.shortName.toUpperCase()}
</MenuItem>
);
})}
</MenuList>
</Menu>
<Text fontWeight={'semibold'}>
Total gameplay items: {data && data[0].gameplayCount}
Total gameplay items: {data && data[0] && data[0].gameplayCount}
</Text>
</Flex>
<Box overflowX="auto">
{data && (
{data && data[0] && (
<Table
width={'100%'}
variant={'simple'}
Expand Down Expand Up @@ -295,7 +304,7 @@ export default function Gameplay() {
})
)}
</Tbody>
{data && (
{data && data[0] && (
<Tfoot bgColor={'white'} height={'50px'}>
<Tr>
<Td borderLeftRadius={16} />
Expand Down
Loading

0 comments on commit ac0841a

Please sign in to comment.