chore(git): Merge

This commit is contained in:
Stixx 2024-12-09 09:44:35 +01:00
commit 8e1acc0bd6
5 changed files with 71 additions and 33 deletions

View File

@ -121,7 +121,17 @@ export const AppBar = () => {
<Container> <Container>
<Toolbar className={styles.toolbar} disableGutters={true}> <Toolbar className={styles.toolbar} disableGutters={true}>
<Box className={styles.logoWrapper}> <Box className={styles.logoWrapper}>
<img src="/logo.svg" alt="Logo" onClick={() => navigate('/')} /> <img
src="/logo.svg"
alt="Logo"
onClick={() => {
if (window.location.pathname === '/') {
location.reload()
} else {
navigate('/')
}
}}
/>
</Box> </Box>
<Box className={styles.rightSideBox}> <Box className={styles.rightSideBox}>

View File

@ -68,6 +68,12 @@ export const Footer = () =>
}} }}
component={Link} component={Link}
to={'/'} to={'/'}
onClick={(event) => {
if (window.location.pathname === '/') {
event.preventDefault()
window.scrollTo(0, 0)
}
}}
variant={'text'} variant={'text'}
> >
Home Home

View File

@ -208,8 +208,11 @@ export const CreatePage = () => {
return uniqueEvents return uniqueEvents
}, []) }, [])
console.log('fineFilteredEvents', fineFilteredEvents) console.info('fineFilteredEvents', fineFilteredEvents)
setFoundUsers(fineFilteredEvents) setFoundUsers(fineFilteredEvents)
if (!fineFilteredEvents.length)
toast.info('No user found with the provided search term')
}) })
.catch((error) => { .catch((error) => {
console.error(error) console.error(error)
@ -770,7 +773,7 @@ export const CreatePage = () => {
title title
} }
setLoadingSpinnerDesc('Signing nostr event for create signature') setLoadingSpinnerDesc('Preparing document(s) for signing')
const createSignature = await signEventForMetaFile( const createSignature = await signEventForMetaFile(
JSON.stringify(content), JSON.stringify(content),

View File

@ -135,6 +135,46 @@ export const HomePage = () => {
const [filter, setFilter] = useState<Filter>('Show all') const [filter, setFilter] = useState<Filter>('Show all')
const [sort, setSort] = useState<Sort>('desc') const [sort, setSort] = useState<Sort>('desc')
const renderSubmissions = () => {
const submissions = Object.keys(parsedSigits)
.filter((s) => {
const { title, signedStatus } = parsedSigits[s]
const isMatch = title?.toLowerCase().includes(q.toLowerCase())
switch (filter) {
case 'Completed':
return signedStatus === SigitStatus.Complete && isMatch
case 'In-progress':
return signedStatus === SigitStatus.Partial && isMatch
case 'Show all':
return isMatch
default:
console.error('Filter case not handled.')
}
})
.sort((a, b) => {
const x = parsedSigits[a].createdAt ?? 0
const y = parsedSigits[b].createdAt ?? 0
return sort === 'desc' ? y - x : x - y
})
if (submissions.length) {
return submissions.map((key) => (
<DisplaySigit
key={`sigit-${key}`}
sigitCreateId={key}
parsedMeta={parsedSigits[key]}
meta={sigits[key]}
/>
))
} else {
return (
<div className={styles.noResults}>
<p>No results</p>
</div>
)
}
}
return ( return (
<div {...getRootProps()} tabIndex={-1}> <div {...getRootProps()} tabIndex={-1}>
<Container className={styles.container}> <Container className={styles.container}>
@ -233,36 +273,8 @@ export const HomePage = () => {
<label htmlFor="file-upload">Click or drag files to upload!</label> <label htmlFor="file-upload">Click or drag files to upload!</label>
)} )}
</button> </button>
<div className={styles.submissions}>
{Object.keys(parsedSigits) <div className={styles.submissions}>{renderSubmissions()}</div>
.filter((s) => {
const { title, signedStatus } = parsedSigits[s]
const isMatch = title?.toLowerCase().includes(q.toLowerCase())
switch (filter) {
case 'Completed':
return signedStatus === SigitStatus.Complete && isMatch
case 'In-progress':
return signedStatus === SigitStatus.Partial && isMatch
case 'Show all':
return isMatch
default:
console.error('Filter case not handled.')
}
})
.sort((a, b) => {
const x = parsedSigits[a].createdAt ?? 0
const y = parsedSigits[b].createdAt ?? 0
return sort === 'desc' ? y - x : x - y
})
.map((key) => (
<DisplaySigit
key={`sigit-${key}`}
sigitCreateId={key}
parsedMeta={parsedSigits[key]}
meta={sigits[key]}
/>
))}
</div>
</Container> </Container>
<Footer /> <Footer />
</div> </div>

View File

@ -99,3 +99,10 @@
gap: 25px; gap: 25px;
grid-template-columns: repeat(auto-fit, minmax(365px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(365px, 1fr));
} }
.noResults {
display: flex;
justify-content: center;
font-weight: normal;
color: #a1a1a1;
}