Skip to content

Commit

Permalink
Merge pull request #15 from HiEventsDev/develop
Browse files Browse the repository at this point in the history
Widget designer UI updates + fix signup email undefined error
  • Loading branch information
daveearley authored Jun 7, 2024
2 parents da994d6 + 626c838 commit 043fa7c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 11 deletions.
8 changes: 5 additions & 3 deletions frontend/src/components/common/EventCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ export function EventCard({event}: EventCardProps) {
<Menu.Item onClick={() => navigate(`/manage/event/${event.id}`)}
leftSection={<IconSettings size={14}/>}
>{t`Manage event`}</Menu.Item>
<Menu.Item onClick={() => navigate(`/manage/event/${event.id}/check-in`)}
leftSection={<IconQrcode size={14}/>}
>{t`Check-in`}</Menu.Item>

{(event.lifecycle_status === 'UPCOMING' || event.lifecycle_status === 'ONGOING') && (
<Menu.Item onClick={() => navigate(`/manage/event/${event.id}/check-in`)}
leftSection={<IconQrcode size={14}/>}
>{t`Check-in`}</Menu.Item>
)}
</Menu.Dropdown>
</Menu>
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/common/GlobalMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Avatar, Menu, UnstyledButton} from "@mantine/core";
import {getInitials, iHavePurchasedALicence} from "../../../utilites/helpers.ts";
import {getInitials, iHavePurchasedALicence, isHiEvents} from "../../../utilites/helpers.ts";
import {IconLogout, IconMoneybag, IconSettingsCog, IconSpeakerphone, IconUser} from "@tabler/icons-react";
import {useGetMe} from "../../../queries/useGetMe.ts";
import {NavLink} from "react-router-dom";
Expand All @@ -20,7 +20,7 @@ export const GlobalMenu = () => {
icon: IconSettingsCog,
link: `/account/settings`,
},
...(iHavePurchasedALicence() ? [] : [
...((iHavePurchasedALicence() || isHiEvents()) ? [] : [
{
label: t`Purchase License`,
icon: IconMoneybag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
.widgetForm {
padding: 20px;
grid-area: form;
margin-top: 20px;

.formHeader {
margin-top: 0;
}
}

.widgetContainer {
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/common/WidgetEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {Popover} from "../Popover";
import {LoadingMask} from '../LoadingMask';
import {Event} from '../../../types.ts';
import {useGetEvent} from "../../../queries/useGetEvent.ts";
import {Card} from "../Card";

export const WidgetEditor = () => {
const {eventId} = useParams();
Expand Down Expand Up @@ -155,7 +156,7 @@ export default App;
return (
<div>
<div className={classes.widgetGrid}>
<div className={classes.widgetForm}>
<Card className={classes.widgetForm}>
<form>
<h2 className={classes.formHeader}>
{t`Widget Settings`}
Expand Down Expand Up @@ -303,7 +304,7 @@ export default App;
</Tabs>

</form>
</div>
</Card>
<div className={classes.previewPane}>
<h2 className={classes.previewHeader}>
{t`Ticket Widget Preview`}
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/components/forms/OrganizerForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {Button, Group, Select, TextInput} from "@mantine/core";
import {currencies} from "../../../../data/currencies.ts";
import {timezones} from "../../../../data/timezones.ts";
import {useFormErrorResponseHandler} from "../../../hooks/useFormErrorResponseHandler.tsx";
import {useGetMe} from "../../../queries/useGetMe.ts";

interface OrganizerFormProps {
onSuccess?: (organizer: Organizer) => void;
Expand Down Expand Up @@ -62,6 +63,7 @@ export const OrganizerForm = ({form}: { form: UseFormReturnType<Partial<Organize
export const OrganizerCreateForm = ({onSuccess}: OrganizerFormProps) => {
const organizerMutation = useCreateOrganizer();
const {data: account, isFetched: accountFetched} = useGetAccount();
const {data: me, isFetched: meFetched} = useGetMe();
const form = useForm({
initialValues: {
name: '',
Expand All @@ -88,16 +90,16 @@ export const OrganizerCreateForm = ({onSuccess}: OrganizerFormProps) => {

useEffect(() => {
if (accountFetched) {
form.setFieldValue('email', String(account?.email));
form.setFieldValue('email', String(me?.email));
form.setFieldValue('currency', String(account?.currency_code));
form.setFieldValue('timezone', String(account?.timezone));
form.setFieldValue('timezone', String(me?.timezone));
}
}, [accountFetched]);

return (
<LoadingContainer>
<form onSubmit={form.onSubmit(handleSubmit)}>
<fieldset disabled={organizerMutation.isLoading || !accountFetched}>
<fieldset disabled={organizerMutation.isLoading || !accountFetched || !meFetched}>
<OrganizerForm form={form as any}/>

<Group gap={10}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ConfirmEmailAddress = () => {
confirmEmailAddressMutation.mutate({token: (token as string), userId: userData?.id}, {
onSuccess: () => {
showSuccess(t`Successfully confirmed email address`);
navigate('/manage/profile');
navigate('/manage/events');
},
onError: () => {
showError(t`Error confirming email address`);
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/utilites/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export const iHavePurchasedALicence = () => {
return getConfig('VITE_I_HAVE_PURCHASED_A_LICENCE');
}

export const isHiEvents = () => {
return getConfig('VITE_FRONTEND_URL')?.includes('hi.events');
}

export const isEmptyHtml = (content: string) => {
const tempDiv = document.createElement('div');
tempDiv.innerHTML = content;
Expand Down

0 comments on commit 043fa7c

Please sign in to comment.