Compare commits

..

No commits in common. "15aa98e9db0453cceea9dba7594e1fee71eb3f52" and "83ddc1bbc810a9f0d20dbf381cca5404cb7eb4c5" have entirely different histories.

3 changed files with 143 additions and 169 deletions

View File

@ -30,7 +30,6 @@
border: 1px solid rgba(0, 0, 0, 0.137); border: 1px solid rgba(0, 0, 0, 0.137);
padding: 5px; padding: 5px;
cursor: pointer; cursor: pointer;
-webkit-user-select: none;
user-select: none; user-select: none;
&.selected { &.selected {
@ -43,13 +42,13 @@
border-color: #01aaad79; border-color: #01aaad79;
} }
} }
} }
} }
} }
.pdfImageWrapper { .pdfImageWrapper {
position: relative; position: relative;
-webkit-user-select: none;
user-select: none; user-select: none;
&.drawing { &.drawing {
@ -95,7 +94,7 @@
background-color: #fff; background-color: #fff;
border: 1px solid rgb(160, 160, 160); border: 1px solid rgb(160, 160, 160);
border-radius: 50%; border-radius: 50%;
color: #e74c3c; color: #E74C3C;
font-size: 10px; font-size: 10px;
cursor: pointer; cursor: pointer;
} }

View File

@ -1,7 +1,7 @@
import { Button, TextField } from '@mui/material' import { Button, TextField } from '@mui/material'
import JSZip from 'jszip' import JSZip from 'jszip'
import { useCallback, useEffect, useState } from 'react' import { useCallback, useEffect, useState } from 'react'
import { useNavigate, useSearchParams } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { useAppSelector } from '../../hooks' import { useAppSelector } from '../../hooks'
import { appPrivateRoutes, appPublicRoutes } from '../../routes' import { appPrivateRoutes, appPublicRoutes } from '../../routes'
@ -40,15 +40,6 @@ type Sort = (typeof SORT_BY)[number]['value']
export const HomePage = () => { export const HomePage = () => {
const navigate = useNavigate() const navigate = useNavigate()
const [searchParams, setSearchParams] = useSearchParams()
const q = searchParams.get('q') ?? ''
useEffect(() => {
const searchInput = document.getElementById('q') as HTMLInputElement | null
if (searchInput) {
searchInput.value = q
}
}, [q])
const [sigits, setSigits] = useState<{ [key: string]: Meta }>({}) const [sigits, setSigits] = useState<{ [key: string]: Meta }>({})
const [parsedSigits, setParsedSigits] = useState<{ const [parsedSigits, setParsedSigits] = useState<{
@ -127,16 +118,13 @@ export const HomePage = () => {
[navigate] [navigate]
) )
const { getRootProps, getInputProps, isDragActive, open } = useDropzone({ const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop })
onDrop,
noClick: true
})
const [search, setSearch] = useState('')
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')
return ( return (
<div {...getRootProps()}>
<Container className={styles.container}> <Container className={styles.container}>
<div className={styles.header}> <div className={styles.header}>
<div className={styles.filters}> <div className={styles.filters}>
@ -168,22 +156,18 @@ export const HomePage = () => {
const searchInput = e.currentTarget.elements.namedItem( const searchInput = e.currentTarget.elements.namedItem(
'q' 'q'
) as HTMLInputElement ) as HTMLInputElement
searchParams.set('q', searchInput.value) setSearch(searchInput.value)
setSearchParams(searchParams)
}} }}
> >
<TextField <TextField
id="q"
name="q" name="q"
placeholder="Search" placeholder="Search"
size="small" size="small"
type="search" type="search"
defaultValue={q}
onChange={(e) => { onChange={(e) => {
// Handle the case when users click native search input's clear or x // Handle the case when users click native search input's clear or x
if (e.currentTarget.value === '') { if (e.currentTarget.value === '') {
searchParams.delete('q') setSearch(e.currentTarget.value)
setSearchParams(searchParams)
} }
}} }}
sx={{ sx={{
@ -212,18 +196,14 @@ export const HomePage = () => {
borderBottomLeftRadius: 0 borderBottomLeftRadius: 0
}} }}
variant={'contained'} variant={'contained'}
aria-label="Submit Search"
> >
<FontAwesomeIcon icon={faSearch} /> <FontAwesomeIcon icon={faSearch} />
</Button> </Button>
</form> </form>
</div> </div>
</div> </div>
<div <div className={styles.dropzone}>
className={`${styles.dropzone} ${isDragActive ? styles.isDragActive : ''}`} <div {...getRootProps()}>
onClick={open}
>
<div>
<input {...getInputProps()} /> <input {...getInputProps()} />
{isDragActive ? ( {isDragActive ? (
<p>Drop the files here ...</p> <p>Drop the files here ...</p>
@ -236,7 +216,7 @@ export const HomePage = () => {
{Object.keys(parsedSigits) {Object.keys(parsedSigits)
.filter((s) => { .filter((s) => {
const { title, signedStatus } = parsedSigits[s] const { title, signedStatus } = parsedSigits[s]
const isMatch = title?.toLowerCase().includes(q.toLowerCase()) const isMatch = title?.toLowerCase().includes(search.toLowerCase())
switch (filter) { switch (filter) {
case 'Completed': case 'Completed':
return signedStatus === SignedStatus.Complete && isMatch return signedStatus === SignedStatus.Complete && isMatch
@ -264,6 +244,5 @@ export const HomePage = () => {
))} ))}
</div> </div>
</Container> </Container>
</div>
) )
} }

View File

@ -53,35 +53,31 @@
} }
.dropzone { .dropzone {
position: relative;
font-size: 16px;
background-color: $overlay-background-color; background-color: $overlay-background-color;
height: 250px; height: 250px;
color: rgba(0, 0, 0, 0.25); transition: padding ease 0.2s;
padding: 15px;
&:hover {
padding: 10px;
> div {
background: rgba(0, 0, 0, 0.15);
}
}
> div {
transition: background-color ease 0.2s;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
&::before {
content: '';
position: absolute;
transition:
background-color ease 0.2s,
inset ease 0.2s;
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
color: rgba(0, 0, 0, 0.25);
height: 100%;
border-radius: 2px; border-radius: 2px;
border: dashed 3px rgba(0, 0, 0, 0.1); border: dashed 3px rgba(0, 0, 0, 0.1);
inset: 15px; font-size: 16px;
}
&.isDragActive,
&:hover {
&::before {
inset: 10px;
background: rgba(0, 0, 0, 0.15);
}
} }
} }