diff --git a/frontend/src/components/image/index.tsx b/frontend/src/components/image/index.tsx index df96dcb..50b6458 100644 --- a/frontend/src/components/image/index.tsx +++ b/frontend/src/components/image/index.tsx @@ -6,12 +6,10 @@ import { Dialog } from "@kobalte/core"; type ImageComponentProps = { ID: string; onDelete: (id: string) => void; - onRefresh: (id: string) => void; -}; +} export const ImageComponent: Component = (props) => { const [isOpen, setIsOpen] = createSignal(false); - const [isRefreshOpen, setIsRefreshOpen] = createSignal(false); return ( <> @@ -29,13 +27,6 @@ export const ImageComponent: Component = (props) => { > × - @@ -54,40 +45,7 @@ export const ImageComponent: Component = (props) => { Cancel - - - - - - - - - - - - Confirm Refresh - - - Are you sure you want to refresh this image? - -
- - - -
@@ -98,11 +56,8 @@ export const ImageComponent: Component = (props) => { ); }; -export const ImageComponentFullHeight: Component = ( - props, -) => { +export const ImageComponentFullHeight: Component = (props) => { const [isOpen, setIsOpen] = createSignal(false); - const [isRefreshOpen, setIsRefreshOpen] = createSignal(false); return ( <> @@ -120,13 +75,6 @@ export const ImageComponentFullHeight: Component = ( > × - @@ -145,40 +93,7 @@ export const ImageComponentFullHeight: Component = ( Cancel - - -
-
-
- - - - - - - Confirm Refresh - - - Are you sure you want to refresh this image? - -
- - - -
diff --git a/frontend/src/contexts/SearchImageContext.tsx b/frontend/src/contexts/SearchImageContext.tsx index 6835eac..e6d87ac 100644 --- a/frontend/src/contexts/SearchImageContext.tsx +++ b/frontend/src/contexts/SearchImageContext.tsx @@ -7,7 +7,7 @@ import { createResource, useContext, } from "solid-js"; -import { deleteImage, deleteImageFromStack, getUserImages, JustTheImageWhatAreTheseNames, reprocessImage } from "../network"; +import { deleteImage, deleteImageFromStack, getUserImages, JustTheImageWhatAreTheseNames } from "../network"; export type SearchImageStore = { imagesByDate: Accessor< @@ -25,7 +25,6 @@ export type SearchImageStore = { onRefetchImages: () => void; onDeleteImage: (imageID: string) => void; onDeleteImageFromStack: (stackID: string, imageID: string) => void; - onRefreshImage: (imageID: string) => void; }; const SearchImageContext = createContext(); @@ -76,9 +75,6 @@ export const SearchImageContextProvider: Component = (props) => { }, onDeleteImageFromStack: (stackID: string, imageID: string) => { deleteImageFromStack(stackID, imageID).then(refetch); - }, - onRefreshImage: (imageID: string) => { - reprocessImage(imageID).then(refetch) } }} > diff --git a/frontend/src/network/index.ts b/frontend/src/network/index.ts index 6899d20..715c109 100644 --- a/frontend/src/network/index.ts +++ b/frontend/src/network/index.ts @@ -18,7 +18,7 @@ import { type BaseRequestParams = Partial<{ path: string; body: RequestInit["body"]; - method: "GET" | "POST" | "DELETE" | "PATCH"; + method: "GET" | "POST" | "DELETE"; }>; // export const base = "https://haystack.johncosta.tech"; @@ -296,19 +296,3 @@ export const createList = async ( throw new ReachedListLimit(); } }; - -export const reprocessImage = async ( - id: string -): Promise => { - const request = getBaseAuthorizedRequest({ - path: `images/${id}`, - method: "PATCH" - }); - - request.headers.set("Content-Type", "application/json"); - - const res = await fetch(request); - if (!res.ok && res.status == 429) { - throw new ReachedListLimit(); - } -} diff --git a/frontend/src/pages/all-images/index.tsx b/frontend/src/pages/all-images/index.tsx index d9a5e38..c588907 100644 --- a/frontend/src/pages/all-images/index.tsx +++ b/frontend/src/pages/all-images/index.tsx @@ -3,6 +3,7 @@ import { Component, For } from "solid-js"; import { createVirtualizer } from "@tanstack/solid-virtual"; import { ImageComponent } from "@components/image"; import { chunkRows } from "./chunk"; +import { deleteImage } from "@network/index"; type ImageOrDate = | { type: "image"; ID: string[] } @@ -11,8 +12,7 @@ type ImageOrDate = export const AllImages: Component = () => { let scrollRef: HTMLDivElement | undefined; - const { imagesByDate, onDeleteImage, onRefreshImage } = - useSearchImageContext(); + const { imagesByDate, onDeleteImage } = useSearchImageContext(); const items = () => { const items: Array = []; @@ -48,15 +48,7 @@ export const AllImages: Component = () => { const item = items()[i.index]; if (item.type === "image") { return ( - - {(id) => ( - - )} - + {(id) => } ); } else { return ( diff --git a/frontend/src/pages/front/recent.tsx b/frontend/src/pages/front/recent.tsx index 7ef5313..4925179 100644 --- a/frontend/src/pages/front/recent.tsx +++ b/frontend/src/pages/front/recent.tsx @@ -1,19 +1,18 @@ import { Component, For } from "solid-js"; import { ImageComponent } from "@components/image"; import { useSearchImageContext } from "@contexts/SearchImageContext"; +import { deleteImage } from "@network/index"; const NUMBER_OF_MAX_RECENT_IMAGES = 10; export const Recent: Component = () => { - const { userImages, onDeleteImage, onRefreshImage } = - useSearchImageContext(); + const { userImages, onDeleteImage } = useSearchImageContext(); const latestImages = () => userImages() .sort( (a, b) => - new Date(b.CreatedAt!).getTime() - - new Date(a.CreatedAt!).getTime(), + new Date(b.CreatedAt!).getTime() - new Date(a.CreatedAt!).getTime(), ) .slice(0, NUMBER_OF_MAX_RECENT_IMAGES); @@ -22,13 +21,7 @@ export const Recent: Component = () => {

Recent Screenshots

- {(image) => ( - - )} + {(image) => }
diff --git a/frontend/src/pages/image/index.tsx b/frontend/src/pages/image/index.tsx index bd6cf83..96b3747 100644 --- a/frontend/src/pages/image/index.tsx +++ b/frontend/src/pages/image/index.tsx @@ -9,22 +9,17 @@ export const ImagePage: Component = () => { const { imageId } = useParams<{ imageId: string }>(); const nav = useNavigate(); - const { userImages, lists, onDeleteImage, onRefreshImage } = - useSearchImageContext(); + const { userImages, lists, onDeleteImage } = useSearchImageContext(); const image = () => userImages().find((i) => i.ImageID === imageId); return (
- { - onDeleteImage(id); - nav("/"); - }} - onRefresh={onRefreshImage} - /> + { + onDeleteImage(id); + nav("/"); + }} />

Description

@@ -32,11 +27,7 @@ export const ImagePage: Component = () => { {(imageList) => ( l.ID === imageList.ListID, - )! - } + list={lists().find((l) => l.ID === imageList.ListID)!} /> )} diff --git a/frontend/src/pages/search/index.tsx b/frontend/src/pages/search/index.tsx index 4358cbb..3c04d60 100644 --- a/frontend/src/pages/search/index.tsx +++ b/frontend/src/pages/search/index.tsx @@ -9,7 +9,7 @@ import { useSearchImageContext } from "@contexts/SearchImageContext"; export const SearchPage: Component = () => { const fuse = useSearch(); - const { onDeleteImage, onRefreshImage } = useSearchImageContext(); + const { onDeleteImage } = useSearchImageContext(); const [searchItems, setSearchItems] = createSignal([]); @@ -41,13 +41,7 @@ export const SearchPage: Component = () => { - {(item) => ( - - )} + {(item) => } No result found