decompme / decomp.me

Collaborative decompilation and reverse engineering website
https://decomp.me
MIT License
348 stars 108 forks source link

Abstracted family sort & added preset and platform sort #1214

Closed conorgolden1 closed 1 month ago

conorgolden1 commented 2 months ago

For issue 1180

sort.webm

conorgolden1 commented 2 months ago

I got the updates to the sorting to work for API fetchs on my local build. I think that because the vercel build uses the live DB that the changes aren't showing. If that is the case the current build does sort the scratches on the backend it just doesn't show here.

conorgolden1 commented 2 months ago

I believe this also resolves #955

mkst commented 2 months ago

This is great - I think the user page (i.e. u/mkst) has been missed from these changes?

Edit - ah it uses a different endpoint.. scratches rather than scratch.

Edit 2:

This change works for non-anonymous users..

diff --git a/frontend/src/app/(navfooter)/u/[username]/page.tsx b/frontend/src/app/(navfooter)/u/[username]/page.tsx
index 7c970205..8b6d38df 100644
--- a/frontend/src/app/(navfooter)/u/[username]/page.tsx
+++ b/frontend/src/app/(navfooter)/u/[username]/page.tsx
@@ -66,8 +66,9 @@ export default async function Page({ params }: { params: { username: string } })
         <section>
             <h2 className="pb-2 text-lg font-medium tracking-tight">Scratches</h2>
             <ScratchList
-                url={userUrl(user) + "/scratches?page_size=20"}
+                url={`/scratch?user=${user}&page_size=20`}
                 item={ScratchItemNoOwner}
+                isSortable={true}
             />
         </section>
     </main>
conorgolden1 commented 1 month ago

This pr should be all set to go unless anyone has anymore reviews they'd like to give

ethteck commented 1 month ago

This change works for non-anonymous users..

diff --git a/frontend/src/app/(navfooter)/u/[username]/page.tsx b/frontend/src/app/(navfooter)/u/[username]/page.tsx
index 7c970205..8b6d38df 100644
--- a/frontend/src/app/(navfooter)/u/[username]/page.tsx
+++ b/frontend/src/app/(navfooter)/u/[username]/page.tsx
@@ -66,8 +66,9 @@ export default async function Page({ params }: { params: { username: string } })
         <section>
             <h2 className="pb-2 text-lg font-medium tracking-tight">Scratches</h2>
             <ScratchList
-                url={userUrl(user) + "/scratches?page_size=20"}
+                url={`/scratch?user=${user}&page_size=20`}
                 item={ScratchItemNoOwner}
+                isSortable={true}
             />
         </section>
     </main>

@mkst I don't think this change does work, as it's showing all scratches now. I tried using owner too since that'd the name of the db field but it didn't work. maybe I'm missing something though and this is a red herring

mkst commented 1 month ago

Oh, that's strange. It was a while ago now but I thought that worked for me locally - I definitely had a sortable drop-down for my own scratches, but I'm sorry that it doesn't actually seem to work for anyone else 😔