-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show bulk archive progress #237
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
79f8183
Show progress bar for archive progress
elie222 5e785a3
share logic for delete and mark read queues
elie222 e4539f5
default to showing all on bulk unsub page
elie222 d8cfdc3
rename queue provider file
elie222 a7c4541
clean up code
elie222 40f5ec0
fix broken references
elie222 d1338da
better error handling
elie222 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,58 @@ | ||
import { useEffect } from "react"; | ||
import { AnimatePresence, motion } from "framer-motion"; | ||
import { useAtomValue } from "jotai"; | ||
import { ProgressBar } from "@tremor/react"; | ||
import { queueAtoms, resetTotalThreads } from "@/store/archive-queue"; | ||
import { cn } from "@/utils"; | ||
|
||
export const ArchiveProgress = () => { | ||
const { totalThreads, activeThreadIds } = useAtomValue(queueAtoms.archive); | ||
|
||
const threadsRemaining = | ||
Object.values(activeThreadIds).filter(Boolean).length; | ||
const totalArchived = totalThreads - threadsRemaining; | ||
const progress = (totalArchived / totalThreads) * 100; | ||
const isCompleted = progress === 100; | ||
|
||
useEffect(() => { | ||
if (isCompleted) { | ||
setTimeout(() => { | ||
resetTotalThreads("archive"); | ||
}, 5_000); | ||
} | ||
}, [isCompleted]); | ||
|
||
if (!totalThreads) return null; | ||
|
||
return ( | ||
<div className="px-4 py-2"> | ||
<AnimatePresence mode="wait"> | ||
<motion.div | ||
key="progress" | ||
initial={{ opacity: 1 }} | ||
exit={{ opacity: 0 }} | ||
transition={{ duration: 0.3 }} | ||
> | ||
<ProgressBar | ||
value={progress} | ||
className="w-full" | ||
color={isCompleted ? "green" : "blue"} | ||
/> | ||
<p className="mt-2 flex justify-between text-sm" aria-live="polite"> | ||
<span | ||
className={cn( | ||
"text-muted-foreground", | ||
isCompleted ? "text-green-500" : "", | ||
)} | ||
> | ||
{isCompleted ? "Archiving complete!" : "Archiving emails..."} | ||
</span> | ||
<span> | ||
{totalArchived} of {totalThreads} emails archived | ||
</span> | ||
</p> | ||
</motion.div> | ||
</AnimatePresence> | ||
</div> | ||
); | ||
}; |
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
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
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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
import type React from "react"; | ||
import { Provider } from "jotai"; | ||
import { ComposeModalProvider } from "@/providers/ComposeModalProvider"; | ||
import { QueueProvider } from "@/providers/QueueProvider"; | ||
import { jotaiStore } from "@/store"; | ||
|
||
export function AppProviders(props: { children: React.ReactNode }) { | ||
return ( | ||
<Provider store={jotaiStore}> | ||
<QueueProvider> | ||
<ComposeModalProvider>{props.children}</ComposeModalProvider> | ||
</QueueProvider> | ||
<ComposeModalProvider>{props.children}</ComposeModalProvider> | ||
</Provider> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
QueueProvider
There are still several files importing
QueueProvider
:apps/web/components/email-list/EmailList.tsx
apps/web/components/CommandK.tsx
apps/web/app/(app)/automation/BulkRunRules.tsx
apps/web/app/(app)/simple/SimpleList.tsx
This indicates that removing
QueueProvider
fromAppProviders.tsx
may break these components. Please ensure thatQueueProvider
has been appropriately replaced or removed from these files.🔗 Analysis chain
LGTM! Verify the impact of removing QueueProvider.
The simplification of the
AppProviders
component by removingQueueProvider
aligns with the PR objectives. This change reduces nesting and potentially improves performance.However, please ensure:
QueueProvider
are properly handled in the new state management system (as mentioned in the AI summary).QueueProvider
.To verify the removal of
QueueProvider
hasn't broken any dependencies, run:Consider adding a comment in this file or updating the relevant documentation to explain why
QueueProvider
was removed and where its functionality has been moved. This will help future developers understand the change.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 94
Script:
Length of output: 135
Script:
Length of output: 451