Add show old switch
This commit is contained in:
parent
ed331a6a56
commit
c968384827
@ -6,6 +6,8 @@ import {
|
|||||||
CardFooter,
|
CardFooter,
|
||||||
Container,
|
Container,
|
||||||
Flex,
|
Flex,
|
||||||
|
FormControl,
|
||||||
|
FormLabel,
|
||||||
Heading,
|
Heading,
|
||||||
Link,
|
Link,
|
||||||
Modal,
|
Modal,
|
||||||
@ -17,6 +19,7 @@ import {
|
|||||||
ModalOverlay,
|
ModalOverlay,
|
||||||
Stack,
|
Stack,
|
||||||
StackDivider,
|
StackDivider,
|
||||||
|
Switch,
|
||||||
Text,
|
Text,
|
||||||
useDisclosure,
|
useDisclosure,
|
||||||
useToast,
|
useToast,
|
||||||
@ -102,6 +105,7 @@ export default function () {
|
|||||||
} = useDisclosure();
|
} = useDisclosure();
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
const [selectedEvent, setSelectedEvent] = useState("");
|
const [selectedEvent, setSelectedEvent] = useState("");
|
||||||
|
const [showOld, setShowOld] = useState(false);
|
||||||
|
|
||||||
async function decide(approved: boolean, eventId: string) {
|
async function decide(approved: boolean, eventId: string) {
|
||||||
const decisionResp = await fetch(
|
const decisionResp = await fetch(
|
||||||
@ -338,7 +342,10 @@ export default function () {
|
|||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
<VStack spacing="8">
|
<VStack spacing="8">
|
||||||
{eventData.map((event) => {
|
{eventData
|
||||||
|
.map((event) => {
|
||||||
|
if (!showOld && event.day < new Date().getUTCDate()) return;
|
||||||
|
|
||||||
const eventCreatorName = members.find(
|
const eventCreatorName = members.find(
|
||||||
(member) => member.id === event.created_by,
|
(member) => member.id === event.created_by,
|
||||||
)?.name;
|
)?.name;
|
||||||
@ -421,6 +428,7 @@ export default function () {
|
|||||||
) : null}
|
) : null}
|
||||||
{can_approve &&
|
{can_approve &&
|
||||||
!event.pending &&
|
!event.pending &&
|
||||||
|
event.approved &&
|
||||||
event.performed_at &&
|
event.performed_at &&
|
||||||
event.type === "rotw" &&
|
event.type === "rotw" &&
|
||||||
!event.answered_at ? (
|
!event.answered_at ? (
|
||||||
@ -465,9 +473,23 @@ export default function () {
|
|||||||
</CardFooter>
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
})}
|
})
|
||||||
|
.filter((e) => e)}
|
||||||
</VStack>
|
</VStack>
|
||||||
<VStack alignItems="start" gap="8px" my="16px">
|
<VStack alignItems="start" gap="8px" my="16px">
|
||||||
|
<FormControl>
|
||||||
|
<FormLabel
|
||||||
|
htmlFor="show-old-events"
|
||||||
|
mb="0"
|
||||||
|
onChange={() => {
|
||||||
|
setShowOld(true);
|
||||||
|
setEventData([...eventData]);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Show old events
|
||||||
|
</FormLabel>
|
||||||
|
<Switch id="show-old-events" />
|
||||||
|
</FormControl>
|
||||||
<Link color="#646cff" href="/book-event" mt="16px" target="_blank">
|
<Link color="#646cff" href="/book-event" mt="16px" target="_blank">
|
||||||
Book an Event
|
Book an Event
|
||||||
</Link>
|
</Link>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user