Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Bit-Barron committed Sep 24, 2024
1 parent f13ef7d commit ad64469
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions web/src/components/images.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export const Images: React.FC = () => {

chrome.storage.local.get(tabId.toString(), (items) => {
const requests = (items[tabId.toString()] as ImageDetails[]) || [];
const imgs = requests.filter(({ type }) => type === "image" || type === "media");
const imgs = requests.filter(
({ type }) => type === "image" || type === "media"
);

const uniqueImages = [
...new Map(imgs.map((item) => [item.url, item])).values(),
Expand All @@ -35,11 +37,12 @@ export const Images: React.FC = () => {
const imagePromises = uniqueImages.map(({ url }) => {
return new Promise<ImageData>((resolve) => {
const img = new Image();
img.onload = () => resolve({
url: img.src,
height: img.height,
isGif: url.toLowerCase().endsWith('.gif')
});
img.onload = () =>
resolve({
url: img.src,
height: img.height,
isGif: url.toLowerCase().endsWith(".gif"),
});
img.onerror = () => resolve({ url, height: 0, isGif: false });
img.src = url;
});
Expand Down Expand Up @@ -95,7 +98,10 @@ export const Images: React.FC = () => {
<div className="relative min-h-screen pb-16">
<Toaster richColors position="top-center" />
{images.length === 0 ? (
<div className="text-xl font-bold">No images found</div>
<>
<div className="text-xl font-bold">No images found</div>
<p>Video Capturing is still in BETA</p>
</>
) : (
<div>
<ImageMasonry />
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/videos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Videos: React.FC = () => {

return (
<section>
<div className="mt-10">
<div className="">
{url ? (
<div>
<video controls src={url} onClick={() => setUrl(url)}>
Expand Down

0 comments on commit ad64469

Please sign in to comment.