Mobile view and misc.
This commit is contained in:
@@ -21,15 +21,18 @@ export default function Homepage({ theme }: any) {
|
|||||||
key: 'bookmarkFilter',
|
key: 'bookmarkFilter',
|
||||||
defaultValue: ['All'],
|
defaultValue: ['All'],
|
||||||
});
|
});
|
||||||
|
const isMobile = window.matchMedia('(max-width: 600px)').matches;
|
||||||
function date() {
|
function date() {
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
const dateOptions: Intl.DateTimeFormatOptions = {
|
const dateOptions: Intl.DateTimeFormatOptions = !isMobile
|
||||||
|
? {
|
||||||
weekday: 'long',
|
weekday: 'long',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
};
|
}
|
||||||
const date = currentDate.toLocaleDateString('en-GB', dateOptions);
|
: {};
|
||||||
|
const date = currentDate.toLocaleDateString('en-US', dateOptions);
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
function greet(list: any) {
|
function greet(list: any) {
|
||||||
@@ -60,9 +63,9 @@ export default function Homepage({ theme }: any) {
|
|||||||
return (
|
return (
|
||||||
<Stack gap={0} className={stackClasses.containerStack} justify='center'>
|
<Stack gap={0} className={stackClasses.containerStack} justify='center'>
|
||||||
<Search />
|
<Search />
|
||||||
<Header date={date()} greet={displayedGreeting} />
|
<Header date={date()} greet={displayedGreeting} isMobile={isMobile} />
|
||||||
<Applications contentType={appFilter} />
|
<Applications contentType={appFilter} isMobile={isMobile} />
|
||||||
<Bookmarks contentType={bookmarkFilter} />
|
<Bookmarks contentType={bookmarkFilter} isMobile={isMobile} />
|
||||||
<SettingsButton
|
<SettingsButton
|
||||||
theme={theme}
|
theme={theme}
|
||||||
setAppFilter={setAppFilter}
|
setAppFilter={setAppFilter}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useState } from 'react';
|
|||||||
import stacks from '../../../styles/Stack.module.css';
|
import stacks from '../../../styles/Stack.module.css';
|
||||||
import texts from '../../../styles/Text.module.css';
|
import texts from '../../../styles/Text.module.css';
|
||||||
|
|
||||||
function AppItem({ url, icon, name }: any) {
|
function AppItem({ url, icon, name, isMobile }: any) {
|
||||||
const [textDecoration, setTextDecoration] = useState<string>('none');
|
const [textDecoration, setTextDecoration] = useState<string>('none');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -16,11 +16,14 @@ function AppItem({ url, icon, name }: any) {
|
|||||||
className={stacks.appItemBox}
|
className={stacks.appItemBox}
|
||||||
>
|
>
|
||||||
<Stack
|
<Stack
|
||||||
|
align={isMobile && 'center'}
|
||||||
|
justify={isMobile && 'center'}
|
||||||
style={{
|
style={{
|
||||||
height: '64px',
|
height: '64px',
|
||||||
marginRight: '1em',
|
width: isMobile && '100%',
|
||||||
marginLeft: '1em',
|
marginRight: isMobile ? '0' : '1em',
|
||||||
paddingTop: '15px',
|
marginLeft: isMobile ? '0' : '1em',
|
||||||
|
paddingTop: isMobile ? '0' : '15px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon icon={`mdi:${icon}`} height={32} width={32} />
|
<Icon icon={`mdi:${icon}`} height={32} width={32} />
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useQueryAPI } from '../../../hooks/useAPI';
|
|||||||
import texts from '../../../styles/Text.module.css';
|
import texts from '../../../styles/Text.module.css';
|
||||||
import AppItem from './AppItem';
|
import AppItem from './AppItem';
|
||||||
|
|
||||||
function Applications({ contentType }: any) {
|
function Applications({ contentType, isMobile }: any) {
|
||||||
const { data, isFetching } = useQueryAPI({ endpoint: 'api/apps' });
|
const { data, isFetching } = useQueryAPI({ endpoint: 'api/apps' });
|
||||||
const [applications, setApplications] = useState([]);
|
const [applications, setApplications] = useState([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -28,7 +28,7 @@ function Applications({ contentType }: any) {
|
|||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridColumnGap: '5px',
|
gridColumnGap: '5px',
|
||||||
gridRowGap: '5px',
|
gridRowGap: '5px',
|
||||||
gridTemplateColumns: '1fr 1fr 1fr 1fr 1fr 1fr',
|
gridTemplateColumns: isMobile ? '1fr 1fr 1fr' : '1fr 1fr 1fr 1fr 1fr 1fr',
|
||||||
gridTemplateRows: '64px',
|
gridTemplateRows: '64px',
|
||||||
paddingBottom: 'var(--module-spacing)',
|
paddingBottom: 'var(--module-spacing)',
|
||||||
}}
|
}}
|
||||||
@@ -45,6 +45,7 @@ function Applications({ contentType }: any) {
|
|||||||
url={application.url}
|
url={application.url}
|
||||||
icon={application.icon}
|
icon={application.icon}
|
||||||
category={application.category}
|
category={application.category}
|
||||||
|
isMobile={isMobile}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useQueryAPI } from '../../../hooks/useAPI';
|
|||||||
import texts from '../../../styles/Text.module.css';
|
import texts from '../../../styles/Text.module.css';
|
||||||
import LinkGroups from './LinkGroups';
|
import LinkGroups from './LinkGroups';
|
||||||
|
|
||||||
function Links({ contentType }: any) {
|
function Links({ contentType, isMobile }: any) {
|
||||||
const { data: linkData, isFetched: linksIsFetched } = useQueryAPI({
|
const { data: linkData, isFetched: linksIsFetched } = useQueryAPI({
|
||||||
endpoint: 'api/links',
|
endpoint: 'api/links',
|
||||||
});
|
});
|
||||||
@@ -36,7 +36,7 @@ function Links({ contentType }: any) {
|
|||||||
flexWrap: 'nowrap',
|
flexWrap: 'nowrap',
|
||||||
gridColumnGap: '20px',
|
gridColumnGap: '20px',
|
||||||
gridRowGap: '0px',
|
gridRowGap: '0px',
|
||||||
gridTemplateColumns: '1fr 1fr 1fr 1fr 1fr',
|
gridTemplateColumns: isMobile ? '1fr 1fr' : '1fr 1fr 1fr 1fr 1fr',
|
||||||
gridTemplateRows: 'auto',
|
gridTemplateRows: 'auto',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -52,6 +52,7 @@ function Links({ contentType }: any) {
|
|||||||
links={bookmarks.filter(
|
links={bookmarks.filter(
|
||||||
(bookmark: any) => bookmark.category === category.categoryName,
|
(bookmark: any) => bookmark.category === category.categoryName,
|
||||||
)}
|
)}
|
||||||
|
isMobile={isMobile}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Stack, Text } from '@mantine/core';
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { textClasses } from '../../../styles';
|
import { textClasses } from '../../../styles';
|
||||||
|
|
||||||
function Header({ greet, date }: any) {
|
function Header({ greet, date, isMobile }: any) {
|
||||||
const [time, setTime] = useState(new Date());
|
const [time, setTime] = useState(new Date());
|
||||||
|
|
||||||
function fixDigits(k: any) {
|
function fixDigits(k: any) {
|
||||||
@@ -26,7 +26,7 @@ function Header({ greet, date }: any) {
|
|||||||
zIndex: '1',
|
zIndex: '1',
|
||||||
clear: 'both',
|
clear: 'both',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
flexDirection: isMobile ? 'column' : 'row',
|
||||||
gap: 0,
|
gap: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -36,7 +36,11 @@ function Header({ greet, date }: any) {
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text className={textClasses.greeting} classNames={textClasses}>
|
<Text
|
||||||
|
className={textClasses.greeting}
|
||||||
|
classNames={textClasses}
|
||||||
|
fz={isMobile && 24}
|
||||||
|
>
|
||||||
{greet}
|
{greet}
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -47,6 +51,7 @@ function Header({ greet, date }: any) {
|
|||||||
justifyContent: 'right',
|
justifyContent: 'right',
|
||||||
width: 'auto',
|
width: 'auto',
|
||||||
gap: 0,
|
gap: 0,
|
||||||
|
flexDirection: isMobile ? 'row' : 'column',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
|
|||||||
@@ -2,20 +2,21 @@ import { Stack, Text } from '@mantine/core';
|
|||||||
import texts from '../../../styles/Text.module.css';
|
import texts from '../../../styles/Text.module.css';
|
||||||
import LinkItem from './LinkItem';
|
import LinkItem from './LinkItem';
|
||||||
|
|
||||||
function LinkGroups({ links, category }: any) {
|
function LinkGroups({ links, category, isMobile }: any) {
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
style={{
|
style={{
|
||||||
marginBottom: '0em',
|
marginBottom: '0em',
|
||||||
display: 'block',
|
display: 'block',
|
||||||
lineHeight: '1.5rem',
|
lineHeight: '1.5rem',
|
||||||
|
overflow: 'hidden',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text className={texts.linkCategory} classNames={texts}>
|
<Text className={texts.linkCategory} classNames={texts}>
|
||||||
{category}
|
{category}
|
||||||
</Text>
|
</Text>
|
||||||
{links?.map((link: any) => (
|
{links?.map((link: any) => (
|
||||||
<LinkItem key={link.name} link={link} />
|
<LinkItem key={link.name} link={link} isMobile={isMobile} />
|
||||||
))}
|
))}
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import { Text } from '@mantine/core';
|
import { Text } from '@mantine/core';
|
||||||
import texts from '../../../styles/Text.module.css';
|
import texts from '../../../styles/Text.module.css';
|
||||||
|
|
||||||
function LinkItem({ link }: any) {
|
function LinkItem({ link, isMobile }: any) {
|
||||||
return (
|
return (
|
||||||
<Text className={texts.linkItem} classNames={texts} component='a' href={link.url}>
|
<Text
|
||||||
|
className={texts.linkItem}
|
||||||
|
classNames={texts}
|
||||||
|
component='a'
|
||||||
|
href={link.url}
|
||||||
|
style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}
|
||||||
|
>
|
||||||
{link.name}
|
{link.name}
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user