Closed Edga380 closed 3 months ago
Name | Link |
---|---|
Latest commit | 5b8e9811b262a2728c361354ec59836347c4477d |
Latest deploy log | https://app.netlify.com/sites/cool-creponne-3e1272/deploys/66657c3a19db5d0008145f6e |
Deploy Preview | https://deploy-preview-225--cool-creponne-3e1272.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
@camelPhonso Thank you for a detail review of the pull request. I will deal with these suggestions/changes as soon as possible. π
@camelPhonso So I did all the changes I hope I did them correctly let me know if I misunderstand something and if it needs to be changed.
Also I added new file in "supabase/models/upsertRow.ts" to replace "editRow" function with "upsertRow" one it looks like it works as you mention it will. This make sense to use again like you said with one route we cover both use cases.
Here is the code I wrote inside the file:
import newClient from '../utils/newClient';
import { PartialItem } from '@/types/supabaseTypes';
export default async function upsertRow(
table: string,
upsertValues: PartialItem
) {
const supabase = newClient();
const { error } = await supabase.from(table).upsert(upsertValues);
if (error) {
console.log(error);
return false;
}
return true;
}
I return a boolean value here because I want to know if it successful or not so I could show an error to the user if it failed to edit.
Checklist:
Description
Closes #193
Files changed
profile/page.tsx
DeleteButton.tsx
Modal.tsx
editRow.ts
New files/folders
"edit-item" folder was created inside "(dashboard)" folder to store two new folders "[id]" and "success"
DisplayDonatedItems.tsx this file was created to display donated items on profile page and fetch the data every time you visit profile page by using "useEffect" method.
success/page.tsx
UI changes
Edit item button added.
Delete item pop up warning changed to align with the styling of delete message pop up styling.
If user have more visible donated items on profile page the last item at the bottom gets cut off in desktop view and mobile view. So what I did I just added a margin at the bottom depending on the screen width. Screen width checked with "useMediaQuary" I used this because I saw this being used in other places.
Desktop:
Mobile:
Edit item form looks exactly the same as Add item form.
Success message after editing item.
Changes to Documentation
None
Tests
None