Skip to content

Commit

Permalink
ref : moved files around
Browse files Browse the repository at this point in the history
  • Loading branch information
Juknum committed Aug 21, 2024
1 parent 1b180f3 commit f1e08d7
Show file tree
Hide file tree
Showing 40 changed files with 103 additions and 84 deletions.
6 changes: 3 additions & 3 deletions src/app/(pages)/(protected)/contribute/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { useHotkeys, useOs, usePrevious, useViewportSize } from '@mantine/hooks'
import { Resolution, Status } from '@prisma/client';

import ForkInfo from '~/components/fork';
import { SmallTile } from '~/components/small-tile';
import { TextureImage } from '~/components/texture-img';
import { Tile } from '~/components/tile';
import { SmallTile } from '~/components/base/small-tile';
import { TextureImage } from '~/components/textures/texture-img';
import { Tile } from '~/components/base/tile';
import { useCurrentUser } from '~/hooks/use-current-user';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { BREAKPOINT_MOBILE_LARGE, COLORS, gitBlobUrl, gitCommitUrl, GRADIENT, GRADIENT_DANGER } from '~/lib/constants';
Expand Down
4 changes: 2 additions & 2 deletions src/app/(pages)/(protected)/council/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { UserRole } from '@prisma/client';

import { RoleGate } from '~/components/role-gate';
import { TabsLayout } from '~/components/tabs';
import { RoleGate } from '~/components/base/role-gate';
import { TabsLayout } from '~/components/base/tabs-layout';

interface ProtectedLayoutProps {
children: React.ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Group, FileInput, TextInput, Badge, Stack, Text } from '@mantine/core';
import { useViewportSize } from '@mantine/hooks';

import { TextureImage } from '~/components/texture-img';
import { TextureImage } from '~/components/textures/texture-img';
import { BREAKPOINT_MOBILE_LARGE } from '~/lib/constants';

import type { ModpackModalFormValues } from './modpack-modal';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Dropzone } from '@mantine/dropzone';
import { useForm } from '@mantine/form';
import { useViewportSize } from '@mantine/hooks';

import { TextureImage } from '~/components/texture-img';
import { TextureImage } from '~/components/textures/texture-img';
import { useCurrentUser } from '~/hooks/use-current-user';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { useWebsocket } from '~/hooks/use-websocket';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useState } from 'react';
import { Button, Group, Table, Text } from '@mantine/core';
import { useDisclosure, useViewportSize } from '@mantine/hooks';

import { Modal } from '~/components/modal';
import { Modal } from '~/components/base/modal';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { BREAKPOINT_MOBILE_LARGE } from '~/lib/constants';
import { notify } from '~/lib/utils';
Expand Down
2 changes: 1 addition & 1 deletion src/app/(pages)/(protected)/council/modpacks/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useDisclosure, usePrevious } from '@mantine/hooks';
import { UserRole } from '@prisma/client';

import { DashboardItem } from '~/components/dashboard-item/dashboard-item';
import { Modal } from '~/components/modal';
import { Modal } from '~/components/base/modal';
import { useCurrentUser } from '~/hooks/use-current-user';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { GRADIENT, GRADIENT_DANGER, ITEMS_PER_PAGE, ITEMS_PER_PAGE_DEFAULT } from '~/lib/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useState, useTransition } from 'react';
import { Button, Group, Stack, Text, TextInput } from '@mantine/core';
import { useForm } from '@mantine/form';

import { TextureImage } from '~/components/texture-img';
import { TextureImage } from '~/components/textures/texture-img';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { GRADIENT, GRADIENT_DANGER } from '~/lib/constants';
import { extractSemver } from '~/lib/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useState } from 'react';
import { Group, Table, Text } from '@mantine/core';
import { useDisclosure, useViewportSize } from '@mantine/hooks';

import { Modal } from '~/components/modal';
import { Modal } from '~/components/base/modal';
import { ModUpload } from '~/components/mods-upload';
import { WarningIcon } from '~/components/warning-icon';
import { useEffectOnce } from '~/hooks/use-effect-once';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Badge, FileInput, Group, MultiSelect, Stack, TextInput, Text } from '@mantine/core';
import { useViewportSize } from '@mantine/hooks';

import { TextureImage } from '~/components/texture-img';
import { TextureImage } from '~/components/textures/texture-img';
import { BREAKPOINT_MOBILE_LARGE, MODS_LOADERS } from '~/lib/constants';

import type { ModModalFormValues } from './mods-modal';
Expand Down
2 changes: 1 addition & 1 deletion src/app/(pages)/(protected)/council/mods/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useDisclosure, usePrevious, useViewportSize } from '@mantine/hooks';
import { UserRole } from '@prisma/client';

import { DashboardItem } from '~/components/dashboard-item/dashboard-item';
import { Modal } from '~/components/modal';
import { Modal } from '~/components/base/modal';
import { ModUpload } from '~/components/mods-upload';
import { useCurrentUser } from '~/hooks/use-current-user';
import { useEffectOnce } from '~/hooks/use-effect-once';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { Button, Group, Stack, Text, Tooltip } from '@mantine/core';
import { useViewportSize } from '@mantine/hooks';
import { ReactCompareSlider } from 'react-compare-slider';

import { TextureImage } from '~/components/texture-img';
import { Tile } from '~/components/tile';
import { TextureImage } from '~/components/textures/texture-img';
import { Tile } from '~/components/base/tile';
import { useCurrentUser } from '~/hooks/use-current-user';
import { BREAKPOINT_DESKTOP_MEDIUM, BREAKPOINT_MOBILE_LARGE, BREAKPOINT_TABLET } from '~/lib/constants';
import { checkContributionStatus } from '~/server/data/contributions';
Expand Down
2 changes: 1 addition & 1 deletion src/app/(pages)/(protected)/council/submissions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { GoAlert, GoCheckCircle, GoCircleSlash } from 'react-icons/go';
import { Accordion, Badge, Group, Select, Stack, Switch, Text } from '@mantine/core';
import { Resolution, UserRole } from '@prisma/client';

import { Tile } from '~/components/tile';
import { Tile } from '~/components/base/tile';
import { useCurrentUser } from '~/hooks/use-current-user';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { getPendingContributions } from '~/server/data/contributions';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useForm } from '@mantine/form';
import { useViewportSize } from '@mantine/hooks';
import { Resolution } from '@prisma/client';

import { FakeInputLabel } from '~/components/fakeInputLabel';
import { TextureImage } from '~/components/texture-img';
import { FakeInputLabel } from '~/components/base/fake-input-label';
import { TextureImage } from '~/components/textures/texture-img';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { BREAKPOINT_MOBILE_LARGE, GRADIENT } from '~/lib/constants';
import { getVanillaTextures } from '~/server/actions/faithful-pack';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState } from 'react';

import { Stack, Tabs } from '@mantine/core';

import { TextureImage } from '~/components/texture-img';
import { TextureImage } from '~/components/textures/texture-img';

import { TextureGeneral } from './texture-general';
import { TextureMCMETAEdition } from './texture-mcmeta';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TbPlus } from 'react-icons/tb';
import { Button, Group, MultiSelect, Stack, Text } from '@mantine/core';
import { useViewportSize } from '@mantine/hooks';

import { TextureImage } from '~/components/texture-img';
import { TextureImage } from '~/components/textures/texture-img';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { BREAKPOINT_MOBILE_LARGE, BREAKPOINT_TABLET, GRADIENT, GRADIENT_DANGER } from '~/lib/constants';
import { sortByName } from '~/lib/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { TbHttpDelete } from 'react-icons/tb';
import { Stack, Group, Divider, Code, Image, Text, Button } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';

import { Modal } from '~/components/modal';
import { Tile } from '~/components/tile';
import { Modal } from '~/components/base/modal';
import { Tile } from '~/components/base/tile';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { GRADIENT, GRADIENT_DANGER } from '~/lib/constants';
import { extractSemver } from '~/lib/utils';
Expand Down
4 changes: 2 additions & 2 deletions src/app/(pages)/(protected)/council/textures/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useEffect, useMemo, useRef, useState, useTransition } from 'react';
import { Badge, Group, Loader, Pagination, Select, Stack, Text, TextInput } from '@mantine/core';
import { useDisclosure, useViewportSize, usePrevious } from '@mantine/hooks';

import { Modal } from '~/components/modal';
import { GalleryTexture } from '~/components/texture';
import { Modal } from '~/components/base/modal';
import { GalleryTexture } from '~/components/textures/texture-gallery';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { BREAKPOINT_MOBILE_LARGE, ITEMS_PER_PAGE, ITEMS_PER_ROW } from '~/lib/constants';
import { notify, searchFilter, sortByName } from '~/lib/utils';
Expand Down
4 changes: 2 additions & 2 deletions src/app/(pages)/(protected)/dashboard/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { UserRole } from '@prisma/client';

import { RoleGate } from '~/components/role-gate';
import { TabsLayout } from '~/components/tabs';
import { RoleGate } from '~/components/base/role-gate';
import { TabsLayout } from '~/components/base/tabs-layout';

interface ProtectedLayoutProps {
children: React.ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion src/app/(pages)/(protected)/dashboard/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Avatar, Badge, Button, Group, Select, Stack, Text, TextInput } from '@m
import { useForm } from '@mantine/form';
import { UserRole } from '@prisma/client';

import { Tile } from '~/components/tile';
import { Tile } from '~/components/base/tile';
import { useCurrentUser } from '~/hooks/use-current-user';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { GRADIENT, MINIMUM_CARD_WIDTH } from '~/lib/constants';
Expand Down
6 changes: 3 additions & 3 deletions src/app/(pages)/(protected)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UserRole } from '@prisma/client';

import { RoleGate } from '~/components/role-gate';
import { RoleGate } from '~/components/base/role-gate';

interface ProtectedLayoutProps {
children: React.ReactNode;
Expand All @@ -13,5 +13,5 @@ const ProtectedLayout = ({ children }: ProtectedLayoutProps) => {
</RoleGate>
);
};
export default ProtectedLayout;

export default ProtectedLayout;
4 changes: 2 additions & 2 deletions src/app/(pages)/(protected)/user/[userId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { signOut } from 'next-auth/react';
import { useSession } from 'next-auth/react';

import ForkInfo from '~/components/fork';
import { TextureImage } from '~/components/texture-img';
import { Tile } from '~/components/tile';
import { TextureImage } from '~/components/textures/texture-img';
import { Tile } from '~/components/base/tile';
import { useCurrentUser } from '~/hooks/use-current-user';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { BREAKPOINT_MOBILE_LARGE, GRADIENT, MAX_NAME_LENGTH, MIN_NAME_LENGTH } from '~/lib/constants';
Expand Down
2 changes: 1 addition & 1 deletion src/app/(pages)/docs/tos/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { List, Text } from '@mantine/core';

import { Tile } from '~/components/tile';
import { Tile } from '~/components/base/tile';

export default function RulesPage() {

Expand Down
2 changes: 1 addition & 1 deletion src/app/(pages)/mods/[modId]/gallery/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { usePrevious } from '@mantine/hooks';
import { useViewportSize } from '@mantine/hooks';
import { Resolution } from '@prisma/client';

import { GalleryTextureWithContribution } from '~/components/texture-contribution';
import { GalleryTextureWithContribution } from '~/components/textures/texture-gallery-contribution';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { BREAKPOINT_MOBILE_LARGE, BREAKPOINT_TABLET, ITEMS_PER_PAGE, ITEMS_PER_ROW } from '~/lib/constants';
import { searchFilter } from '~/lib/utils';
Expand Down
4 changes: 2 additions & 2 deletions src/app/(pages)/mods/[modId]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { TfiWorld } from 'react-icons/tfi';
import { Button, Group, Loader, Stack, Text, Title } from '@mantine/core';
import { useViewportSize } from '@mantine/hooks';

import { TabsLayout } from '~/components/tabs';
import { TextureImage } from '~/components/texture-img';
import { TabsLayout } from '~/components/base/tabs-layout';
import { TextureImage } from '~/components/textures/texture-img';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { BREAKPOINT_MOBILE_LARGE } from '~/lib/constants';
import { getModDownloads, getModFromForgeId } from '~/server/data/mods';
Expand Down
2 changes: 1 addition & 1 deletion src/app/(pages)/mods/[modId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { usePrevious } from '@mantine/hooks';
import { useViewportSize } from '@mantine/hooks';
import { Resolution } from '@prisma/client';

import { Tile } from '~/components/tile';
import { Tile } from '~/components/base/tile';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { BREAKPOINT_MOBILE_LARGE, ITEMS_PER_PAGE, RESOLUTIONS_COLORS, EMPTY_PROGRESSION, ITEMS_PER_PAGE_DEFAULT } from '~/lib/constants';
import { getModFromForgeId } from '~/server/data/mods';
Expand Down
4 changes: 2 additions & 2 deletions src/app/(pages)/mods/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { TfiWorld } from 'react-icons/tfi';
import { ActionIcon, Button, Checkbox, Group, InputLabel, MultiSelect, Pagination, Radio, Select, Stack, Text, TextInput } from '@mantine/core';
import { useViewportSize, usePrevious } from '@mantine/hooks';

import { TextureImage } from '~/components/texture-img';
import { Tile } from '~/components/tile';
import { Tile } from '~/components/base/tile';
import { TextureImage } from '~/components/textures/texture-img';
import { useEffectOnce } from '~/hooks/use-effect-once';
import { BREAKPOINT_MOBILE_LARGE, BREAKPOINT_TABLET, ITEMS_PER_PAGE, ITEMS_PER_PAGE_DEFAULT, MODS_LOADERS } from '~/lib/constants';
import { searchFilter, sortByName, sortBySemver } from '~/lib/utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { FC } from 'react';

import { Stack, Text } from '@mantine/core';

interface Props {
Expand All @@ -7,7 +9,7 @@ interface Props {
gap?: number | string;
}

export function FakeInputLabel({ gap, label, description, children }: Props) {
export const FakeInputLabel: FC<Props> = ({ gap, label, description, children }) => {
return (
<Stack gap={0} mt={2}>
<Stack gap={0}>
Expand Down Expand Up @@ -36,4 +38,4 @@ export function FakeInputLabel({ gap, label, description, children }: Props) {
</div>
</Stack>
);
}
};
8 changes: 5 additions & 3 deletions src/components/modal.tsx → src/components/base/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { FC } from 'react';

import { Modal as MantineModal, Title } from '@mantine/core';
import { useViewportSize } from '@mantine/hooks';

import { BREAKPOINT_MOBILE_LARGE } from '~/lib/constants';

interface ModalProps {
interface Props {
opened: boolean;
onClose: () => void;
title?: React.ReactNode;
Expand All @@ -13,7 +15,7 @@ interface ModalProps {
children?: React.ReactNode;
}

export function Modal({ opened, onClose, title, children, popup, forceFullScreen }: ModalProps) {
export const Modal: FC<Props> = ({ opened, onClose, title, children, popup, forceFullScreen }) => {
const { width } = useViewportSize();

return (
Expand All @@ -31,4 +33,4 @@ export function Modal({ opened, onClose, title, children, popup, forceFullScreen
{children}
</MantineModal>
);
}
};
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
'use client';

import type { FC } from 'react';

import { Stack, Title, Text } from '@mantine/core';
import { UserRole } from '@prisma/client';

import { useCurrentUser } from '~/hooks/use-current-user';

interface RoleGateProps {
interface Props {
children: React.ReactNode;
allowedRoles: UserRole[];
};

export const RoleGate = ({
children,
allowedRoles,
}: RoleGateProps) => {
/**
* A component that gates access to children based on the logged user's role.
*/
export const RoleGate: FC<Props> = ({ children, allowedRoles }) => {
const user = useCurrentUser();
const role = user?.role;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { FC } from 'react';

import { Tile } from './tile';

import type { CardProps, PolymorphicComponentProps } from '@mantine/core';

export function SmallTile({ children, style, ...props }: PolymorphicComponentProps<'div', CardProps>) {
export const SmallTile: FC<PolymorphicComponentProps<'div', CardProps>> = ({ children, style, ...props }) => {
return (
<Tile
w="100%"
Expand All @@ -17,4 +19,4 @@ export function SmallTile({ children, style, ...props }: PolymorphicComponentPro
{children}
</Tile>
);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useViewportSize } from '@mantine/hooks';

import { BREAKPOINT_MOBILE_LARGE } from '~/lib/constants';

interface TabsLayoutProps<T extends string[]> {
interface Props<T extends string[]> {
noMargin?: boolean;
children: React.ReactNode;
defaultValue?: T[number];
Expand All @@ -20,7 +20,7 @@ interface TabsLayoutProps<T extends string[]> {
}[];
};

export const TabsLayout = <T extends string[]>({ children, tabs, defaultValue, isLayout, variant, noMargin }: TabsLayoutProps<T>) => {
export const TabsLayout = <T extends string[]>({ children, tabs, defaultValue, isLayout, variant, noMargin }: Props<T>) => {
const { width } = useViewportSize();
const router = useRouter();
const pathname = usePathname();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
'use client';

import { useEffect, useState } from 'react';
import type { FC } from 'react';

import { TbSun, TbMoon, TbSunMoon, TbCloud } from 'react-icons/tb';

import { ActionIcon, useMantineColorScheme } from '@mantine/core';

import type { MantineColorScheme } from '@mantine/core';

export const ThemeSwitch = () => {
export const ThemeSwitch: FC = () => {
const colorSchemes: MantineColorScheme[] = ['light', 'dark', 'auto'];

const [icon, setIcon] = useState<React.ReactNode>(<TbCloud className="w-5 h-5"/>);
Expand Down
Loading

0 comments on commit f1e08d7

Please sign in to comment.