-
Notifications
You must be signed in to change notification settings - Fork 1
UI and Manager assigment #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
co to za UUID, nie powinno być czegoś takiego, parametr opcjonalny
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
package.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generalnie brakowało mi podczas odpalenia
"@fullcalendar/daygrid": "^6.1.14",
"@fullcalendar/interaction": "^6.1.14",
"@fullcalendar/timegrid": "^6.1.14",
@@ -17,7 +18,7 @@ const useHours = (date?: string) => { | |||
refetch: hoursRefetch, | |||
isLoading: hoursLoading, | |||
isError: hoursError | |||
} = useSuspenseQuery(hoursQueryOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+
const calendarRef = useRef<FullCalendar | null>(null); | ||
|
||
const getCurrentMonth = useCallback(() => { | ||
if (!calendarRef.current) return '2024-06'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tutaj też lipa, nie może tak być
|
||
if (!users) return <p>Brak użytkowników</p>; | ||
if (meLoading) return <p>Loading...</p>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nie wiem czy potrzebna jest osobna strona do tego. Może dać to do edycji użytkownika?
No description provided.