Skip to content

Commit

Permalink
renamed var
Browse files Browse the repository at this point in the history
  • Loading branch information
piggydoughnut committed Feb 1, 2024
1 parent 67ec555 commit 7c79186
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
9 changes: 6 additions & 3 deletions src/client/components/OfficeFloorMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,16 @@ export const OfficeFloorMap: React.FC<OfficeFloorMapProps> = ({
{mapObjects(1)}
</div>
<div
className={cn(!!panZoom ? 'block' : 'hidden', 'border border-gray-300')}
className={cn(
!!panZoom ? 'block' : 'hidden',
'border border-gray-300 rounded-sm'
)}
>
<ImageWithPanZoom
src={area.map}
alt={`${area.name} floor plan`}
className="block w-full opacity-60 object-contain overflow-hidden"
initialScale={1}
className="block w-full opacity-60 object-contain overflow-hidden rounded-sm"
initialScale={2}
initialStartPosition={
initialStartingPosition
? {
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/ui/ImageWithPanZoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const ImageWithPanZoom = ({
onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd}
className={cn(
'overflow-hidden relative w-full h-full sm:h-auto',
'overflow-hidden relative w-full h-full sm:h-auto rounded-sm',
containerClassName
)}
>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/events/client/components/EventsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ const EventsList = ({

export const EventsPage = () => {
const officeId = useStore(stores.officeId)
const { data: events, isFetched } = useUpcomingEvents(officeId, true)
const { data: events, isFetched } = useUpcomingEvents(officeId, 'time')
const { data: myEvents, isFetched: isMineFetched } = useMyEvents(
officeId,
true
'status'
)
if (!isFetched && !isMineFetched) {
return null
Expand Down
2 changes: 1 addition & 1 deletion src/modules/events/client/components/UpcomingEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const UpcomingEvents: React.FC = () => {
const [eventData, setEventData] = useState<Array<EventPublicResponse>>([])

useEffect(() => {
if (events?.length && isFetched) {
if (!!events?.length && isFetched) {
let limit = page === 1 ? pageSize : page * pageSize
const result = paginateArray(events, 1, limit)
setEventData(result)
Expand Down
11 changes: 4 additions & 7 deletions src/modules/events/client/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,21 @@ export const useEventsAdmin = (
)
}

export const useUpcomingEvents = (
officeId: string | null,
byTime?: boolean
) => {
export const useUpcomingEvents = (officeId: string | null, sortBy?: string) => {
const path = '/user-api/events/event'
return useQuery<EventPublicResponse[] | EventTimeMap, AxiosError>(
[path, { office: officeId, byTime }],
[path, { office: officeId, sortBy }],
async ({ queryKey }) =>
(await api.get<EventPublicResponse[]>(path, { params: queryKey[1] }))
.data,
{ enabled: !!officeId }
)
}

export const useMyEvents = (officeId: string | null, byStatus?: boolean) => {
export const useMyEvents = (officeId: string | null, sortBy?: string) => {
const path = '/user-api/events/event/me'
return useQuery<Event[] | MyEventsStatusMap, AxiosError>(
[path, { office: officeId, byStatus }],
[path, { office: officeId, sortBy }],
async ({ queryKey }) =>
(await api.get<Event[]>(path, { params: queryKey[1] })).data,
{ enabled: !!officeId }
Expand Down
8 changes: 4 additions & 4 deletions src/modules/events/server/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ const userRouter: FastifyPluginCallback = async function (fastify, opts) {
'/event',
async (
req: FastifyRequest<{
Querystring: { byTime?: boolean }
Querystring: { sortBy?: string }
}>,
reply
) => {
Expand All @@ -467,7 +467,7 @@ const userRouter: FastifyPluginCallback = async function (fastify, opts) {
order: ['startDate'],
})

if (!!req.query.byTime) {
if (!!req.query.sortBy && req.query.sortBy === 'time') {
const pastEvents = await fastify.db.Event.findAll({
where: {
endDate: {
Expand Down Expand Up @@ -496,7 +496,7 @@ const userRouter: FastifyPluginCallback = async function (fastify, opts) {
'/event/me',
async (
req: FastifyRequest<{
Querystring: { byStatus?: boolean }
Querystring: { sortBy?: string }
}>,
reply
) => {
Expand Down Expand Up @@ -541,7 +541,7 @@ const userRouter: FastifyPluginCallback = async function (fastify, opts) {
attributes: ['eventId', 'status', 'id'],
})

if (!!req.query.byStatus) {
if (!!req.query.sortBy && req.query.sortBy === 'status') {
const result: Record<
EventApplicationStatus,
Array<Event & { applicationId: string }>
Expand Down

0 comments on commit 7c79186

Please sign in to comment.