Skip to content

Commit

Permalink
Merge pull request #64 from AndyOooh/ED1-46-feature-start-end-date-co…
Browse files Browse the repository at this point in the history
…ntract

Ed1 46 feature start end date contract
  • Loading branch information
AndyOooh authored Jan 16, 2024
2 parents 1fdf67e + 3dbf119 commit 376a4d4
Show file tree
Hide file tree
Showing 16 changed files with 168 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const CurrentUserProvider = ({ children }: { children: React.ReactNode })

useEffect(() => {
if (userDoc) {
console.log('user detected..........');
console.log('currentUser detected..........');
setCurrentUser(userDoc.data());
}
}, [userDoc]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const PrivateRoutes = ({ children }: { children: React.ReactNode }) => {
useEffect(() => {
const fetchToken = async () => {
const token = await user?.getIdTokenResult(true);
console.log('🚀 PrivateRoutes, token:', token);
!loading && !token?.claims.basic_info_done && router.push('/login');
};

Expand Down
5 changes: 0 additions & 5 deletions apps/app/src/app/(protected)/events/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ export const EventsLala = ({ events }: Props) => {
<p>{location.address}</p>
<a
className='link link-secondary'
// href={`https://maps.google.com/?ll=${location.coords.lat},${location.coords.lng}`}
// href={`https://www.google.com/maps/search/?api=1&query_place_id=${location.place_id}`}
href={`https://www.google.com/maps/search/?api=1&query=${location.coords.lat}%2C-${location.coords.lng}&query_place_id=${location.place_id}`}
target='_blank'
rel='noreferrer'>
Expand Down Expand Up @@ -145,9 +143,6 @@ export const EventsLala = ({ events }: Props) => {
{field.name === 'number_workers'
? `${role.accepted || 0}/${field.value}`
: field.value}
{/* {field.name === 'number_workers' ? 'lalalal' : 'sdfsdfds'} */}
{/* {field_name === 'number_workers' ? 'lalalal' : field_name} */}
{/* {role[field_name]} */}
</th>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ export const formArrayEventDetails: FormInput[] = [
],
},
{
title: 'date',
title: 'start_date',
type: 'date',
tooltip: 'Enter date of the event',
tooltip: 'Enter start date of the event',
},
{
title: 'end_date',
type: 'date',
tooltip: 'Enter end date of the event',
},
{
title: 'description',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ type Props = {

export const EventInfo = ({ register, errors }: Props) => {
const { currentUser } = useContext(CurrUserContext);
const dateIndex = 3;
const descriptionIndex = 5;
const descriptionFormData = formArrayEventDetails[descriptionIndex];

return currentUser ? (
<div className={styles.form}>
<div className='w-full grid grid-cols-2 gap-6'>
{formArrayEventDetails.slice(0, 4).map(info => (
{formArrayEventDetails.slice(0, dateIndex).map(info => (
<div key={info.title}>
{info.type === 'select' ? (
<Select
Expand All @@ -30,15 +33,7 @@ export const EventInfo = ({ register, errors }: Props) => {
register={register}
label={true}
maxW='max-w-md'
/>
) : info.type === 'date' ? (
<DatePicker
name={info.title}
defaultValue={currentUser && formatDate(currentUser[info.title], true)}
register={register}
label={true}
maxW='max-w-md'
extraProps={info.extraProps}
tooltip={info.tooltip}
/>
) : (
<TextInput
Expand All @@ -48,20 +43,37 @@ export const EventInfo = ({ register, errors }: Props) => {
label={true}
maxW='max-w-md'
prepend={info.prepend}
tooltip={info.tooltip}
/>
)}
<FormError formError={errors?.[info.title]?.message as string} />
{/* <FormError formError={errors?.[info.title]?.message} /> */}
</div>
))}
<div className='w-full flex gap-4'>
{formArrayEventDetails.slice(dateIndex, descriptionIndex).map(info => (
<div key={info.title} className='w-full'>
<DatePicker
name={info.title}
defaultValue={currentUser && formatDate(currentUser[info.title], true)}
register={register}
label={true}
maxW='max-w-[75%]'
extraProps={info.extraProps}
tooltip={info.tooltip}
/>
</div>
))}
</div>
</div>
<div className='w-1/2 mx-auto'>
<TextInput
name={formArrayEventDetails[4].title}
defaultValue={currentUser && currentUser[formArrayEventDetails[4].title]}
name={descriptionFormData.title}
defaultValue={currentUser && currentUser[descriptionFormData.title]}
register={register}
label={true}
maxW='max-w-md'
tooltip={descriptionFormData.tooltip}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export const eventDetailsSchema = yup.object().shape({
event_name: stringNullable(yup.string().min(2)),
event_type: yup.string().oneOf(Object.values(EventType)),
// location: yup.string().min(3),
date: yup.date().min(new Date()),
start_date: yup.date().min(new Date()),
end_date: yup.date().min(new Date()),
description: yup.string().min(3),
// roles: yup.array().of(yup.string().min(2)),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const EventLocation = ({ register, errors, setValue, address }: Props) =>
register={register}
label={true}
maxW='max-w-md'
tooltip='Describe the location of the event.'
// prepend={info.prepend}
/>

Expand Down
Loading

2 comments on commit 376a4d4

@vercel
Copy link

@vercel vercel bot commented on 376a4d4 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dev-event-dee2 – ./apps/app

dev-event-dee2-andyoooh.vercel.app
dev-event-dee2.vercel.app
dev-event-dee2-git-main-andyoooh.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 376a4d4 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

event-dee-2 – ./apps/landing

event-dee-2-git-main-andyoooh.vercel.app
event-dee-2-andyoooh.vercel.app
event-dee2.vercel.app

Please sign in to comment.