-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #343 from Pixilib/editTable
Edit table
- Loading branch information
Showing
36 changed files
with
672 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { useSelector } from "react-redux"; | ||
import { deleteAnonymizeQueue, getAnonymizeQueue, getExistingAnonymizeQueues } from "../services/queues"; | ||
import { useCustomMutation, useCustomQuery } from "../utils"; | ||
import { RootState } from "../store"; | ||
import { Spinner } from "../ui"; | ||
import ProgressQueueBar from "../queue/ProgressQueueBar"; | ||
import { Queue } from "../utils/types"; | ||
|
||
const AnonQueues = () => { | ||
const currentUserId = useSelector((state: RootState) => state.user.currentUserId); | ||
|
||
const { data: existingAnonymizeQueues } = useCustomQuery<string[]>( | ||
['queue', 'anon', currentUserId?.toString() || ''], | ||
() => getExistingAnonymizeQueues(currentUserId) | ||
); | ||
|
||
const firstQueue = existingAnonymizeQueues?.[0] | ||
|
||
const { data, isPending , isLoading} = useCustomQuery<Queue>( | ||
['queue', 'anon', firstQueue], | ||
() => getAnonymizeQueue(firstQueue), | ||
{ refetchInterval: 2000, | ||
enabled : existingAnonymizeQueues?.length > 0 } | ||
); | ||
|
||
const { mutate: mutateDeleteQueue } = useCustomMutation( | ||
() => deleteAnonymizeQueue(firstQueue), | ||
[['queue', 'anon']] | ||
); | ||
|
||
if (existingAnonymizeQueues?.length > 0 && isPending) return <Spinner />; | ||
|
||
return ( | ||
<div className="w-full space-y-4"> | ||
{existingAnonymizeQueues?.map((uuid) => ( | ||
<div | ||
key={uuid} | ||
className="p-4 bg-white border border-gray-100 shadow-inner rounded-xl" | ||
> | ||
<ProgressQueueBar queueData={data} onDelete={mutateDeleteQueue} /> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default AnonQueues; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.