Testaustime / testaustime-frontend

Frontend for the time tracking system Testaustime
https://testaustime.fi
MIT License
17 stars 11 forks source link

Add button to delete sessions #211

Open Eldemarkki opened 1 year ago

Eldemarkki commented 1 year ago

API: /activity/delete

Aspireve commented 1 year ago

Hey Hi!! @Eldemarkki Could I try working on this issue? All I need to do is to create a button that fires a function that POSTs /activity/delete right? Or is there something even more deeper that I would have to consider?

DrVilepis commented 1 year ago

Not really, you can feel free to try implemeting it.

Eldemarkki commented 1 year ago

Yes, you can!

I was thinking that when you click on a project name in the dashboard it opens a modal that shows a list of all sessions of that project. Then on each row you have same data about the session, and a button that deletes it.

Writing this comment I realized the scope grew a lot… would you like to try doing all of that? There are examples in the cadebase already for opening modals and creating lists with buttons.

Aspireve commented 1 year ago

Ill try my best doing this!!

Aspireve commented 1 year ago

Hmm I have been trying to run the application it always shoots this error image I guess its an error with this command in the package.json file image On deleting that line I was able to run the aaplication but then was met with another error image

Chicken commented 1 year ago

The first error is most likely an issue because of windows. This way of setting environmental variables only works on unix platforms. A solution such as cross-env might be preferable. Or simply setting the variable in an .env file.

Aspireve commented 1 year ago

Hmm I didn't quite understand, could you explain

Chicken commented 1 year ago

Simply move the VITE_API_URL=https://api.testaustime.fi to an .env file and remove it from the package script.

Aspireve commented 1 year ago

Ohh I actually tried using cross-env as you said before and it surprisingly worked!! Thanks a lot!! Now ill get to trying to solve this issue!!

Aspireve commented 1 year ago

And also after that I was able to register properly without any issues!!

Aspireve commented 1 year ago

Hey Hi could you explain how could I do it? Cause I tried doing some stuff and it kinda doesnt seem to work What I did

  1. Locate the place where the edit project button resides
  2. Add another element to the same title to open a modal to delete the project session image
  3. Opened Modal image

But after this for some reason I am not able to send a response back to delete the project. If you could provide the method you use to send APIs I could try finding my way from there

Chicken commented 1 year ago

The project calls the API with some fancy custom hooks with react-query mutations. See the src/hooks/useActivities.tsx Also, GitHub issues are a bit clunky. May I interest you in joining our Discord Server where we could communicate faster in, for example, the #koodaus channel. It's a finnish server but we will talk in English if asked.

Eldemarkki commented 1 year ago

@Aspireve I meant that the user should be able to delete individual sessions, but currently by your screenshots it looks like you are deleting a whole project. I think we should show the session list in the same dialog as the project editing (EditProjectModal). There, each session would have a delete button.

Here's a very rough sketch of what I was thinking: image

Aspireve commented 1 year ago

Ohh Something like that!! I thought by sessions you meant the programs that the user has worked upon

Eldemarkki commented 1 year ago

@Aspireve Are you still doing this? If not, I can de-assign you from this task so someone else can do this.

Aspireve commented 1 year ago

Hey Hi!! Thanks for reminding about this, I actually started learning about TypeScript to solve this issue and during that completely forgot about this issue. I try solving it right away!!

Aspireve commented 1 year ago

Hey Hi!! So again while running it I got the error of invalid credentials while registering aswell So is there any solution to that

Eldemarkki commented 1 year ago

Looks like we have some misconfiguration in the rate limiting, because it appears that only 1 person can register per day. The "Invalid credentials" message is completely wrong, and I've created issue #294 for it. Could @DrVilepis, @lajp or @Chicken figure out a way for @Aspireve to create an account?

If you want to, you can also join our Discord server at https://discord.gg/GRD9G74D so we can give more real-time help. We are mostly Finnish speakers there, but we all know English too so that's no problem!