Conversation
…ndars according to month works
…ours worked in current month, previous month and 2 months ago.
…nager as an Admin post method is used inside assignUserToManager component instead of being in separated hook
| const [currentMonth, setCurrentMonth] = useState<string>('2024-06'); | ||
| const { me } = useMe(); | ||
| const { userHours } = useUserHours( | ||
| selectedUser || '074221c8-1545-4e4b-a241-60addeaa0764' |
There was a problem hiding this comment.
co to za UUID, nie powinno być czegoś takiego, parametr opcjonalny
bykowskiolaf
left a comment
There was a problem hiding this comment.
Generalnie dobry kod. Kilka małych poprawek:
- Zmieniłbym strukture kodu, widziałem, że większość komponentów jest wrzucona do Users, fajnie to rozdzielić na te foldery gdzie jest używane
- Niektóre z palca wpisane wartości, to na pewno nie przejdzie
- React router jest po to żeby pomóc - nie przeszkadzac. Używaj więcej funkcjonalności od nich jeśli już jest w projekcie
- To samo się tyczy do react query, super, że robiłeś hooki, ale możesz je wykorzystywać w routerze
There was a problem hiding this comment.
Generalnie brakowało mi podczas odpalenia
"@fullcalendar/daygrid": "^6.1.14",
"@fullcalendar/interaction": "^6.1.14",
"@fullcalendar/timegrid": "^6.1.14",
| refetch: hoursRefetch, | ||
| isLoading: hoursLoading, | ||
| isError: hoursError | ||
| } = useSuspenseQuery(hoursQueryOptions); |
There was a problem hiding this comment.
Czemu nie SuspenseQuery? Router by się zajmował ładowaniem danych
| const [currentMonth, setCurrentMonth] = useState<string>('2024-06'); | ||
| const { me } = useMe(); | ||
| const { userHours } = useUserHours( | ||
| selectedUser || '074221c8-1545-4e4b-a241-60addeaa0764' |
| const calendarRef = useRef<FullCalendar | null>(null); | ||
|
|
||
| const getCurrentMonth = useCallback(() => { | ||
| if (!calendarRef.current) return '2024-06'; |
There was a problem hiding this comment.
Wartości z palca to raczej średnio
| interface SelectUsersProps { | ||
| selectedUser: string | null; | ||
| setSelectedUser: ( | ||
| userId: string | null | '074221c8-1545-4e4b-a241-60addeaa0764' |
There was a problem hiding this comment.
Tutaj też lipa, nie może tak być
| const { me, meLoading, meError } = useMe(); | ||
|
|
||
| if (!users) return <p>Brak użytkowników</p>; | ||
| if (meLoading) return <p>Loading...</p>; |
There was a problem hiding this comment.
Do takich właśnie rzeczy jest react router i suspense query, nie trzeba sie martwic o loading
| import assignUserToManager from '@/pages/Users/components/assignUserToManager'; | ||
| import { createFileRoute } from '@tanstack/react-router'; | ||
|
|
||
| export const Route = createFileRoute('/_dashboard/assignUserToManager')({ |
There was a problem hiding this comment.
Nie wiem czy potrzebna jest osobna strona do tego. Może dać to do edycji użytkownika?
No description provided.