1
0
mirror of https://github.com/hexolan/panels.git synced 2026-05-20 11:39:22 +01:00

feat(frontend): updates to latest mantine attributes

Pending adaption to breaking changes for element attributes since
changed within existing components. Adjustments to `ta`, `gap`, `fw`,
etc.
This commit is contained in:
2026-05-14 14:53:04 +01:00
parent 998eb474ec
commit 0e21fe9483
26 changed files with 58 additions and 57 deletions
@@ -26,9 +26,9 @@ function AppHeader() {
<Menu> <Menu>
<Menu.Target> <Menu.Target>
<Button color='teal' variant='outline'> <Button color='teal' variant='outline'>
<Group spacing={7}> <Group gap={7}>
<Avatar color='teal' radius='xl' size={25} /> <Avatar color='teal' radius='xl' size={25} />
<Text weight={500} size='sm' sx={{ lineHeight: 1 }} mr={3}> <Text fw={500} size='sm' mr={3}> {/* sx={{ lineHeight: 1 }} */}
{currentUser.username} {currentUser.username}
</Text> </Text>
<IconChevronDown size={20} /> <IconChevronDown size={20} />
@@ -36,7 +36,7 @@ function AppNavbar() {
return ( return (
<Navbar width={{ base: 300 }} p='xs'> <Navbar width={{ base: 300 }} p='xs'>
<Navbar.Section py='xs'> <Navbar.Section py='xs'>
<Text size='xs' color='dimmed' my='xs' weight={500}>Browse</Text> <Text size='xs' color='dimmed' my='xs' fw={500}>Browse</Text>
<NavbarButton text='Feed' page='/' icon={IconTrendingUp} /> <NavbarButton text='Feed' page='/' icon={IconTrendingUp} />
<NavbarButton text='Find Panels' page='/panels' icon={IconSearch} /> <NavbarButton text='Find Panels' page='/panels' icon={IconSearch} />
</Navbar.Section> </Navbar.Section>
@@ -48,7 +48,7 @@ function AppNavbar() {
borderTop: `${rem(1)} solid ${theme.colors.gray[3]}` borderTop: `${rem(1)} solid ${theme.colors.gray[3]}`
})} })}
> >
<Text size='xs' color='dimmed' m='xs' weight={500}>Suggested Panels</Text> <Text size='xs' color='dimmed' m='xs' fw={500}>Suggested Panels</Text>
<NavbarButton text='panel/Panel' page='/panel/Panel' icon={IconMessages} /> <NavbarButton text='panel/Panel' page='/panel/Panel' icon={IconMessages} />
</Navbar.Section> </Navbar.Section>
</Navbar> </Navbar>
@@ -5,7 +5,7 @@ import type { Comment } from '../app/types/common'
function CommentsFeed({ comments }: { comments: Comment[] }) { function CommentsFeed({ comments }: { comments: Comment[] }) {
return ( return (
<Stack spacing='sm'> <Stack gap='sm'>
{Object.values(comments).map(comment => <FeedComment key={comment.id} comment={comment} />)} {Object.values(comments).map(comment => <FeedComment key={comment.id} comment={comment} />)}
</Stack> </Stack>
) )
@@ -12,7 +12,7 @@ import type { UpdateCommentData } from '../app/types/comments'
const FeedCommentBase = ({ children, extraChildren }: { children: React.ReactNode, extraChildren?: React.ReactNode }) => ( const FeedCommentBase = ({ children, extraChildren }: { children: React.ReactNode, extraChildren?: React.ReactNode }) => (
<Paper shadow='sm' radius='md' p='md' withBorder> <Paper shadow='sm' radius='md' p='md' withBorder>
<Group w='100%' position='apart'> <Group w='100%' justify='apart'>
<Group> <Group>
<ThemeIcon color='teal' variant='light' size='xl'><IconMessage /></ThemeIcon> <ThemeIcon color='teal' variant='light' size='xl'><IconMessage /></ThemeIcon>
{children} {children}
@@ -63,12 +63,12 @@ const FeedPost = ({ post, hidePanel, hideAuthor }: { post: Post, hidePanel?: boo
return ( return (
<Paper shadow='xl' radius='lg' p='lg' withBorder> <Paper shadow='xl' radius='lg' p='lg' withBorder>
<Group spacing='xs'> <Group gap='xs'>
{panelElement} {panelElement}
{authorElement} {authorElement}
</Group> </Group>
<Box component={Link} to={panelData ? `/panel/${panelData.name}/post/${post.id}` : '#'} style={{ textDecoration: 'none', color: 'inherit' }}> <Box component={Link} to={panelData ? `/panel/${panelData.name}/post/${post.id}` : '#'} style={{ textDecoration: 'none', color: 'inherit' }}>
<Text mt={3} weight={600} lineClamp={1}>{post.title}</Text> <Text mt={3} fw={600} lineClamp={1}>{post.title}</Text>
<Text size='sm' lineClamp={2}>{post.content}</Text> <Text size='sm' lineClamp={2}>{post.content}</Text>
<Text size='xs' color='dimmed' mt={3}>Click to View</Text> <Text size='xs' color='dimmed' mt={3}>Click to View</Text>
</Box> </Box>
@@ -9,10 +9,10 @@ function HomePostFeed() {
if (isLoading) { if (isLoading) {
return <SkeletonPostFeed /> return <SkeletonPostFeed />
} else if (!data) { } else if (!data) {
return <Text align='center' color='red'>Failed to Load Posts</Text> return <Text ta='center' color='red'>Failed to Load Posts</Text>
} else if (!data.length) { } else if (!data.length) {
// Check that there are posts. // Check that there are posts.
return <Text align='center'>No Posts Found!</Text> return <Text ta='center'>No Posts Found!</Text>
} }
return ( return (
@@ -1,5 +1,6 @@
import { Progress } from '@mantine/core' import { Progress } from '@mantine/core'
const LoadingBar = () => <Progress color='lime' radius='xs' size='sm' value={100} striped animate /> // animate
const LoadingBar = () => <Progress color='lime' radius='xs' size='sm' value={100} striped />
export default LoadingBar export default LoadingBar
@@ -133,14 +133,14 @@ const PagePostItem = ({ post, setPost }: { post: Post, setPost: React.Dispatch<P
)} )}
{modifying ? <ModifyPostForm post={post} setModifying={setModifying} setPost={setPost} /> : ( {modifying ? <ModifyPostForm post={post} setModifying={setModifying} setPost={setPost} /> : (
<Stack align='flex-start' mt={2} spacing={1}> <Stack align='flex-start' mt={2} gap={1}>
<Text weight={600}>{post.title}</Text> <Text fw={600}>{post.title}</Text>
<Text size='sm'>{post.content}</Text> <Text size='sm'>{post.content}</Text>
<Text size='xs' color='dimmed' mt={3}>Created {post.createdAt}</Text> <Text size='xs' color='dimmed' mt={3}>Created {post.createdAt}</Text>
</Stack> </Stack>
)} )}
{errorMsg && <Text color='red' align='center' size='xs' mt='md'>{'Error: ' + errorMsg}</Text>} {errorMsg && <Text color='red' ta='center' size='xs' mt='md'>{'Error: ' + errorMsg}</Text>}
</Paper> </Paper>
) )
} }
@@ -24,13 +24,13 @@ const PanelLayoutComponent = ({ panel, setPanel }: { panel: Panel, setPanel: Rea
<> <>
<Paper py={rem(50)} shadow='md' sx={{ borderBottom: '1px' }}> <Paper py={rem(50)} shadow='md' sx={{ borderBottom: '1px' }}>
<Container> <Container>
<Group position='apart'> <Group gap='apart'>
<Box component={Link} to={`/panel/${panel.name}`} style={{ textDecoration: 'none' }}> <Box component={Link} to={`/panel/${panel.name}`} style={{ textDecoration: 'none' }}>
<Text size='lg' color='black'>{panel.name}</Text> <Text size='lg' color='black'>{panel.name}</Text>
<Text size='sm' color='dimmed'>{panel.description}</Text> <Text size='sm' color='dimmed'>{panel.description}</Text>
</Box> </Box>
<Group spacing='sm'> <Group gap='sm'>
{currentUser && <Button size='xs' variant='filled' color='teal' component={Link} to={`/panel/${panel.name}/posts/new`}>Create Post</Button>} {currentUser && <Button size='xs' variant='filled' color='teal' component={Link} to={`/panel/${panel.name}/posts/new`}>Create Post</Button>}
{currentUser && currentUser.isAdmin && <Button size='xs' variant='outline' color='green' component={Link} to={`/panel/${panel.name}/settings`}>Manage Panel</Button>} {currentUser && currentUser.isAdmin && <Button size='xs' variant='outline' color='green' component={Link} to={`/panel/${panel.name}/settings`}>Manage Panel</Button>}
</Group> </Group>
@@ -10,10 +10,10 @@ function PanelPostFeed({ panel }: { panel: Panel }) {
if (isLoading) { if (isLoading) {
return <SkeletonPostFeed /> return <SkeletonPostFeed />
} else if (!data) { } else if (!data) {
return <Text align='center'>Failed to Load Posts</Text> return <Text ta='center'>Failed to Load Posts</Text>
} else if (!data.length) { } else if (!data.length) {
// Check that there are posts. // Check that there are posts.
return <Text align='center'>No Posts Found!</Text> return <Text ta='center'>No Posts Found!</Text>
} }
return ( return (
@@ -13,7 +13,7 @@ function PostCommentsFeed({ post }: { post: Post }) {
</Center> </Center>
) )
} else if (!data) { } else if (!data) {
return <Text color='red' align='center'>Failed to Load Comments</Text> return <Text color='red' ta='center'>Failed to Load Comments</Text>
} else if (!data.length) { } else if (!data.length) {
return null return null
} }
@@ -2,11 +2,11 @@ import { Paper, Skeleton, Box, Stack, Group } from '@mantine/core'
const SkeletonFeedPost = () => ( const SkeletonFeedPost = () => (
<Paper shadow='xl' radius='lg' p='lg' withBorder> <Paper shadow='xl' radius='lg' p='lg' withBorder>
<Group spacing='xs'> <Group gap='xs'>
<Skeleton height={8} mt={6} width='20%' radius='xl' /> <Skeleton height={8} mt={6} width='20%' radius='xl' />
<Skeleton height={8} mt={6} width='20%' radius='xl' /> <Skeleton height={8} mt={6} width='20%' radius='xl' />
</Group> </Group>
<Stack mt={2} spacing={1}> <Stack mt={2} gap={1}>
<Box> <Box>
<Skeleton h='md' radius='xl' w='60%' /> <Skeleton h='md' radius='xl' w='60%' />
<Skeleton h='md' radius='xl' mt='sm' /> <Skeleton h='md' radius='xl' mt='sm' />
@@ -61,7 +61,7 @@ function UserLayout() {
<Paper w='100%'> <Paper w='100%'>
<Box h='100%' pos='relative'> <Box h='100%' pos='relative'>
<Center h='100%'> <Center h='100%'>
<Text weight={600} mr={3}>User:</Text> <Text fw={600} mr={3}>User:</Text>
<Text>{data.username}</Text> <Text>{data.username}</Text>
</Center> </Center>
@@ -10,10 +10,10 @@ function UserPostFeed({ user }: { user: User }) {
if (isLoading) { if (isLoading) {
return <SkeletonPostFeed /> return <SkeletonPostFeed />
} else if (!data) { } else if (!data) {
return <Text align='center' color='red'>Failed to Load Posts</Text> return <Text ta='center' color='red'>Failed to Load Posts</Text>
} else if (!data.length) { } else if (!data.length) {
// Check that there are posts. // Check that there are posts.
return <Text align='center'>No Posts Found!</Text> return <Text ta='center'>No Posts Found!</Text>
} }
return ( return (
+10 -10
View File
@@ -17,22 +17,22 @@ const ErrorPage = () => {
<Center h='100%'> <Center h='100%'>
<Container> <Container>
<Title <Title
align='center' ta='center'
weight={800} fw={800}
sx={(theme) => ({ // sx={(theme) => ({
fontSize: rem(38), // fontSize: rem(38),
[theme.fn.smallerThan('sm')]: { // [theme.fn.smallerThan('sm')]: {
fontSize: rem(32), // fontSize: rem(32),
}, // },
})} // })}
> >
{title} {title}
</Title> </Title>
<Text size='lg' color='dimmed' maw={rem(250)} align='center' my='xl'> <Text size='lg' color='dimmed' maw={rem(250)} ta='center' my='xl'>
{subTitle} {subTitle}
</Text> </Text>
<Group position='center'> <Group justify='center'>
<Button component={Link} to='/' variant='subtle' size='md'> <Button component={Link} to='/' variant='subtle' size='md'>
Back to Home Back to Home
</Button> </Button>
@@ -17,12 +17,12 @@ const ExplorePanelsPage = () => {
)} )}
<Divider my='md' variant='dotted' /> <Divider my='md' variant='dotted' />
<Stack spacing='sm' align='stretch'> <Stack gap='sm' align='stretch'>
<Paper shadow='xl' radius='md' p='md' withBorder component={Link} to='/panel/Panel'> <Paper shadow='xl' radius='md' p='md' withBorder component={Link} to='/panel/Panel'>
<Group> <Group>
<ThemeIcon color='teal' variant='light' size='xl'><IconMessages /></ThemeIcon> <ThemeIcon color='teal' variant='light' size='xl'><IconMessages /></ThemeIcon>
<Box> <Box>
<Text weight={600}>Panel</Text> <Text fw={600}>Panel</Text>
<Text>The first and therefore defacto primary panel.</Text> <Text>The first and therefore defacto primary panel.</Text>
<Text color='dimmed' size='xs' mt={3}>Click to View</Text> <Text color='dimmed' size='xs' mt={3}>Click to View</Text>
</Box> </Box>
@@ -33,7 +33,7 @@ const ExplorePanelsPage = () => {
<Group> <Group>
<ThemeIcon color='red' variant='light' size='xl'><IconTableOff /></ThemeIcon> <ThemeIcon color='red' variant='light' size='xl'><IconTableOff /></ThemeIcon>
<Box> <Box>
<Text weight={600}>Note</Text> <Text fw={600}>Note</Text>
<Text>This page is exemplary as this feature is currently unimplemented.</Text> <Text>This page is exemplary as this feature is currently unimplemented.</Text>
<Text color='dimmed' size='xs' mt={3}>Planned Functionality</Text> <Text color='dimmed' size='xs' mt={3}>Planned Functionality</Text>
</Box> </Box>
+1 -1
View File
@@ -7,7 +7,7 @@ const Homepage = () => {
<Container mt='xl'> <Container mt='xl'>
<Title>Feed</Title> <Title>Feed</Title>
<Divider my='md' variant='dotted' /> <Divider my='md' variant='dotted' />
<Stack my='lg' spacing='md'> <Stack my='lg' gap='md'>
<HomePostFeed /> <HomePostFeed />
</Stack> </Stack>
</Container> </Container>
+3 -3
View File
@@ -46,11 +46,11 @@ const NewPanelPage = () => {
return ( return (
<Center h='95%'> <Center h='95%'>
<Container> <Container>
<Title align='center' weight={900}>Create a Panel</Title> <Title ta='center' fw={900}>Create a Panel</Title>
<Paper withBorder shadow='md' radius='md' p={30} mt={30}> <Paper withBorder shadow='md' radius='md' p={30} mt={30}>
<form onSubmit={panelForm.onSubmit(submitPanelForm)}> <form onSubmit={panelForm.onSubmit(submitPanelForm)}>
<Stack spacing='md'> <Stack gap='md'>
<TextInput <TextInput
label='Name' label='Name'
placeholder='e.g. music, programming, football' placeholder='e.g. music, programming, football'
@@ -63,7 +63,7 @@ const NewPanelPage = () => {
{...panelForm.getInputProps('description')} {...panelForm.getInputProps('description')}
/> />
{ errorMsg && <Text color='red' align='center'>{'Error: ' + errorMsg}</Text> } { errorMsg && <Text color='red' ta='center'>{'Error: ' + errorMsg}</Text> }
<Button type='submit' variant='outline' color='teal' disabled={isLoading} fullWidth>Create Panel</Button> <Button type='submit' variant='outline' color='teal' disabled={isLoading} fullWidth>Create Panel</Button>
</Stack> </Stack>
+2 -2
View File
@@ -49,7 +49,7 @@ const NewPanelPostPage = () => {
return ( return (
<Paper shadow='md' radius='md' p='lg' withBorder> <Paper shadow='md' radius='md' p='lg' withBorder>
<form onSubmit={createPostForm.onSubmit(submitPost)}> <form onSubmit={createPostForm.onSubmit(submitPost)}>
<Stack spacing='md'> <Stack gap='md'>
<TextInput <TextInput
label='Title' label='Title'
placeholder='Post Title' placeholder='Post Title'
@@ -62,7 +62,7 @@ const NewPanelPostPage = () => {
{...createPostForm.getInputProps('content')} {...createPostForm.getInputProps('content')}
/> />
{ errorMsg && <Text color='red' align='center'>{'Error: ' + errorMsg}</Text> } { errorMsg && <Text color='red' ta='center'>{'Error: ' + errorMsg}</Text> }
<Button type='submit' variant='outline' color='teal' disabled={isLoading} fullWidth> <Button type='submit' variant='outline' color='teal' disabled={isLoading} fullWidth>
Create Post Create Post
+1 -1
View File
@@ -8,7 +8,7 @@ function PanelPage() {
const { panel } = useOutletContext<PanelContext>() const { panel } = useOutletContext<PanelContext>()
return ( return (
<Stack my='lg' spacing='md'> <Stack my='lg' gap='md'>
<PanelPostFeed panel={panel} /> <PanelPostFeed panel={panel} />
</Stack> </Stack>
) )
+1 -1
View File
@@ -53,7 +53,7 @@ function PanelPostPage() {
<Box mb='lg'> <Box mb='lg'>
<PagePost post={data} /> <PagePost post={data} />
<Divider my='md' variant='none' /> <Divider my='md' variant='none' />
<Stack spacing='sm'> <Stack gap='sm'>
{ currentUser && <CreateComment post={data} addNewComment={addNewComment} /> } { currentUser && <CreateComment post={data} addNewComment={addNewComment} /> }
{ newComments.length > 0 && <CommentsFeed comments={newComments} /> } { newComments.length > 0 && <CommentsFeed comments={newComments} /> }
<PostCommentsFeed post={data} /> <PostCommentsFeed post={data} />
@@ -51,7 +51,7 @@ const UpdatePanelForm = ({
return ( return (
<form onSubmit={panelForm.onSubmit(submitUpdatePanel)}> <form onSubmit={panelForm.onSubmit(submitUpdatePanel)}>
<Stack spacing='md'> <Stack gap='md'>
<TextInput label='Name' {...panelForm.getInputProps('name')} /> <TextInput label='Name' {...panelForm.getInputProps('name')} />
<Textarea label='Description' {...panelForm.getInputProps('description')} /> <Textarea label='Description' {...panelForm.getInputProps('description')} />
@@ -90,7 +90,7 @@ function PanelSettingsPage() {
return ( return (
<Paper mt='md' radius='lg' shadow='md' p='lg' withBorder> <Paper mt='md' radius='lg' shadow='md' p='lg' withBorder>
<Center> <Center>
<Group spacing='sm'> <Group gap='sm'>
{modifying {modifying
? <Button color='teal' onClick={() => { setModifying(false); setErrorMsg('') }}>Stop Modifying</Button> ? <Button color='teal' onClick={() => { setModifying(false); setErrorMsg('') }}>Stop Modifying</Button>
: <Button color='teal' onClick={() => setModifying(true)}>Modify Panel</Button> : <Button color='teal' onClick={() => setModifying(true)}>Modify Panel</Button>
+4 -4
View File
@@ -47,8 +47,8 @@ function SignInPage() {
return ( return (
<Center h='95%'> <Center h='95%'>
<Container> <Container>
<Title align='center' weight={900}>Sign In</Title> <Title ta='center' fw={900}>Sign In</Title>
<Text color='dimmed' size='sm' align='center' mt={5}> <Text color='dimmed' size='sm' ta='center' mt={5}>
Do not have an account yet?{' '} Do not have an account yet?{' '}
<Anchor size='sm' component={Link} to='/signup'>Sign up</Anchor> instead. <Anchor size='sm' component={Link} to='/signup'>Sign up</Anchor> instead.
</Text> </Text>
@@ -56,7 +56,7 @@ function SignInPage() {
<Paper withBorder shadow='md' radius='md' p={30} mt={30}> <Paper withBorder shadow='md' radius='md' p={30} mt={30}>
<form onSubmit={loginForm.onSubmit(submitLoginForm)}> <form onSubmit={loginForm.onSubmit(submitLoginForm)}>
<Stack spacing='md'> <Stack gap='md'>
<TextInput <TextInput
label='Username' label='Username'
placeholder='Your username' placeholder='Your username'
@@ -69,7 +69,7 @@ function SignInPage() {
{...loginForm.getInputProps('password')} {...loginForm.getInputProps('password')}
/> />
{ errorMsg && <Text color='red' align='center'>{'Error: ' + errorMsg}</Text> } { errorMsg && <Text color='red' ta='center'>{'Error: ' + errorMsg}</Text> }
<Button type='submit' color='teal' disabled={isLoading} fullWidth>Login</Button> <Button type='submit' color='teal' disabled={isLoading} fullWidth>Login</Button>
</Stack> </Stack>
+4 -4
View File
@@ -56,15 +56,15 @@ const SignUpPage = () => {
return ( return (
<Center h='95%'> <Center h='95%'>
<Container> <Container>
<Title align='center' weight={900}>Sign Up</Title> <Title ta='center' fw={900}>Sign Up</Title>
<Text color='dimmed' size='sm' align='center' mt={5}> <Text color='dimmed' size='sm' ta='center' mt={5}>
Already have an account?{' '} Already have an account?{' '}
<Anchor size='sm' component={Link} to='/signin'>Sign in</Anchor> instead. <Anchor size='sm' component={Link} to='/signin'>Sign in</Anchor> instead.
</Text> </Text>
<Paper withBorder shadow='md' radius='md' p={30} mt={30}> <Paper withBorder shadow='md' radius='md' p={30} mt={30}>
<form onSubmit={registrationForm.onSubmit(submitRegistrationForm)}> <form onSubmit={registrationForm.onSubmit(submitRegistrationForm)}>
<Stack spacing='md'> <Stack gap='md'>
<TextInput <TextInput
label='Username' label='Username'
placeholder='Your username' placeholder='Your username'
@@ -83,7 +83,7 @@ const SignUpPage = () => {
{...registrationForm.getInputProps('confPassword')} {...registrationForm.getInputProps('confPassword')}
/> />
{ errorMsg && <Text color='red' align='center'>{'Error: ' + errorMsg}</Text> } { errorMsg && <Text color='red' ta='center'>{'Error: ' + errorMsg}</Text> }
<Button type='submit' color='teal' disabled={isLoading} fullWidth>Register</Button> <Button type='submit' color='teal' disabled={isLoading} fullWidth>Register</Button>
</Stack> </Stack>
+1 -1
View File
@@ -8,7 +8,7 @@ function UserPage() {
const { user } = useOutletContext<UserContext>() const { user } = useOutletContext<UserContext>()
return ( return (
<Stack my='lg' spacing='md'> <Stack my='lg' gap='md'>
<UserPostFeed user={user} /> <UserPostFeed user={user} />
</Stack> </Stack>
) )
+1 -1
View File
@@ -8,7 +8,7 @@ function UserAboutPage() {
return ( return (
<Paper mt='md' radius='lg' shadow='md' p='lg' withBorder> <Paper mt='md' radius='lg' shadow='md' p='lg' withBorder>
<Text weight={500}>About {user.username}</Text> <Text fw={500}>About {user.username}</Text>
{user.createdAt && <Text>Signed up {new Date(user.createdAt).toUTCString()}</Text>} {user.createdAt && <Text>Signed up {new Date(user.createdAt).toUTCString()}</Text>}
</Paper> </Paper>
) )