Skip to content

Commit c6cd50d

Browse files
authored
Merge pull request #46 from HiEventsDev/develop
Merge develop into main
2 parents 07eae45 + be0f899 commit c6cd50d

File tree

27 files changed

+606
-470
lines changed

27 files changed

+606
-470
lines changed

.github/pull_request_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Thank you for creating a PR! We appreciate your contribution to Hi.Events.
2+
3+
To make the process as smooth as possible, please ensure you've read the [contributing guidelines](https://github.com/HiEventsDev/hi.events/blob/develop/CONTRIBUTING.md) before proceeding.
4+
5+
Please include a summary of the changes and the issue being fixed or the feature being added. The more detail, the better!
6+
7+
## Checklist
8+
9+
- [ ] I have read the contributing guidelines.
10+
- [ ] My code is of good quality and follows the coding standards of the project.
11+
- [ ] I have tested my changes, and they work as expected.
12+
13+
Thank you for your contribution! 🎉

.github/workflows/cla.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "CLA Assistant"
2+
on:
3+
issue_comment:
4+
types: [created]
5+
pull_request_target:
6+
types: [opened,closed,synchronize]
7+
8+
permissions:
9+
actions: write
10+
contents: read
11+
pull-requests: write
12+
statuses: write
13+
14+
jobs:
15+
CLAAssistant:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: "CLA Assistant"
19+
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
20+
uses: contributor-assistant/[email protected]
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
24+
with:
25+
path-to-signatures: 'signatures.json'
26+
path-to-document: 'https://github.com/HiEventsDev/hi.events/blob/develop/CLA.md'
27+
branch: 'main'
28+
allowlist: daveearley,bot*
29+
remote-organization-name: HiEventsDev
30+
remote-repository-name: cla-signatures

CLA.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Hi.Events Contributor License Agreement
2+
3+
Thank you for your interest in contributing to Hi.Events!
4+
5+
Like many open source projects, we ask you to please sign this Contributor License Agreement (CLA) to confirm that you have the rights to your contributions and grant us the necessary permissions to use them. This helps us manage the project effectively and offer both open-source and commercial licenses.
6+
7+
**Contributor License Agreement**
8+
9+
This Contributor License Agreement ("Agreement") documents the rights granted by contributors to Hi.Event Ltd. ("Company"). To make this a binding legal agreement, please review the following terms and sign below.
10+
11+
You hereby grant to Hi.Event Ltd. a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable license to use, modify, reproduce, distribute, and sublicense your contributions under the terms of both the GNU Affero General Public License version 3 (AGPL-3.0) and a commercial license, without any compensation to you.
12+
13+
You confirm that:
14+
15+
1. Each contribution is an original creation of yours and that you have the right to grant the licenses stated above.
16+
2. Your contributions do not infringe any third-party copyrights, patents, trademarks, or other rights.
17+
3. You will notify Hi.Event Ltd. of any facts or circumstances of which you become aware that would make your representations in this Agreement inaccurate in any respect.
18+
19+
For more details on how to contribute, please read our [Contribution Guidelines](https://github.com/HiEventsDev/hi.events/blob/develop/CONTRIBUTING.md).
20+
21+
Before contributing to Hi.Events, you must accept and agree to the terms of this Agreement.
22+
23+
Thank you for your contributions and support!

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ Please ensure that your pull request includes:
5353
- Tests for new functionality or bug fixes, if applicable.
5454
- A demo or screenshots, if the changes are visual.
5555

56+
Once you create a pull request, a CLA bot will automatically check if you have signed the Contributor License Agreement (CLA).
57+
Signing is as simple as leaving a comment on the pull request with the message `I have read the CLA Document and I hereby sign the CLA`.
58+
We require all contributors to sign the CLA to ensure that we have the necessary permissions to use and distribute your contributions.
59+
5660
## Development Setup
5761

5862
To set up the development environment for Hi.Events, follow the detailed instructions in our [Getting Started with Local Development guide](https://hi.events/docs/getting-started/local-development).

frontend/src/components/common/OrdersTable/index.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import {prettyDate, relativeDate} from "../../../utilites/dates.ts";
1515
import {ViewOrderModal} from "../../modals/ViewOrderModal";
1616
import {useDisclosure} from "@mantine/hooks";
17-
import {useEffect, useState} from "react";
17+
import {useState} from "react";
1818
import {CancelOrderModal} from "../../modals/CancelOrderModal";
1919
import {SendMessageModal} from "../../modals/SendMessageModal";
2020
import {notifications} from "@mantine/notifications";
@@ -28,6 +28,7 @@ import {ShowForDesktop, ShowForMobile} from "../Responsive/ShowHideComponents.ts
2828
import {useResendOrderConfirmation} from "../../../mutations/useResendOrderConfirmation.ts";
2929
import {OrderStatusBadge} from "../OrderStatusBadge";
3030
import {formatNumber} from "../../../utilites/helpers.ts";
31+
import {useUrlHash} from "../../../hooks/useUrlHash.ts";
3132

3233
interface OrdersTableProps {
3334
event: Event,
@@ -42,17 +43,11 @@ export const OrdersTable = ({orders, event}: OrdersTableProps) => {
4243
const [orderId, setOrderId] = useState<IdParam>();
4344
const resendConfirmationMutation = useResendOrderConfirmation();
4445

45-
useEffect(() => {
46-
if (window?.location.hash) {
47-
const match = window?.location.hash.match(/^#order-(\d+)$/);
48-
49-
if (match && match[1]) {
50-
const orderId = match[1];
51-
setOrderId(orderId);
52-
viewModal.open();
53-
}
54-
}
55-
}, []);
46+
useUrlHash(/^#order-(\d+)$/, (matches => {
47+
const orderId = matches![1];
48+
setOrderId(orderId);
49+
viewModal.open();
50+
}));
5651

5752
if (orders.length === 0) {
5853
return <NoResultsSplash

frontend/src/components/common/PromoCodeTable/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {useState} from "react";
1212
import {NoResultsSplash} from "../NoResultsSplash";
1313
import {confirmationDialog} from "../../../utilites/confirmationDialog.tsx";
1414
import {useDeletePromoCode} from "../../../mutations/useDeletePromoCode.ts";
15+
import {eventHomepageUrl} from "../../../utilites/urlHelper.ts";
1516

1617
interface PromoCodeTableProps {
1718
event: Event,
@@ -23,6 +24,7 @@ export const PromoCodeTable = ({event, promoCodes, openCreateModal}: PromoCodeTa
2324
const [promoCodeId, setPromoCodeId] = useState<number | undefined>();
2425
const [editModalOpen, {open: openEditModal, close: closeEditModal}] = useDisclosure(false);
2526
const deleteMutation = useDeletePromoCode();
27+
const clipboard = useClipboard({ timeout: 500 });
2628

2729
const handleEditModal = (promoCodeId: number | undefined) => {
2830
setPromoCodeId(promoCodeId);
@@ -168,6 +170,8 @@ export const PromoCodeTable = ({event, promoCodes, openCreateModal}: PromoCodeTa
168170
</Menu.Item>
169171
<Menu.Item leftSection={<IconCopy size={14}/>}
170172
onClick={() => {
173+
clipboard.copy(eventHomepageUrl(event) + `?promo_code=${code?.code}`);
174+
showSuccess(t`URL copied to clipboard`)
171175
}}>
172176
{t`Copy URL`}
173177
</Menu.Item>

frontend/src/components/layouts/Event/Event.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
transition: box-shadow 0.3s ease;
4242
position: sticky;
4343
top: 0;
44-
box-shadow: 0 5px 5px 0 #00000010;
44+
box-shadow: 0 5px 5px 0 #00000005;
4545
z-index: 1;
4646

4747
.breadcrumbs {

frontend/src/components/routes/event/GettingStarted/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const GettingStarted = () => {
6969
{t`Create tickets for your event, set prices, and manage available quantity.`}
7070
</p>
7171

72-
<Button variant={'light'} component={'a'} href={'/manage/event/' + eventId + '/tickets'}>
72+
<Button variant={'light'} component={'a'} href={'/manage/event/' + eventId + '/tickets#create-ticket'}>
7373
{hasTickets ? t`Add More tickets` : t`Add tickets`}
7474
</Button>
7575

frontend/src/components/routes/event/tickets.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {useGetTickets} from "../../../queries/useGetTickets.ts";
1414
import {TableSkeleton} from "../../common/TableSkeleton";
1515
import {Pagination} from "../../common/Pagination";
1616
import {t} from "@lingui/macro";
17+
import {useUrlHash} from "../../../hooks/useUrlHash.ts";
1718

1819
export const Tickets = () => {
1920
const [searchParams, setSearchParams] = useFilterQueryParamSync();
@@ -23,12 +24,14 @@ export const Tickets = () => {
2324
const pagination = ticketsQuery?.data?.meta;
2425
const tickets = ticketsQuery?.data?.data;
2526
const enableSorting =
26-
(Object.keys(searchParams).length === 0) || // searchParams is an empty object
27+
(Object.keys(searchParams).length === 0) ||
2728
(
28-
(searchParams.sortBy === 'order' || searchParams.sortBy === undefined) && // orderBy is 'order' or undefined
29-
(searchParams.query === '' || searchParams.query === undefined) // query is an empty string or undefined
29+
(searchParams.sortBy === 'order' || searchParams.sortBy === undefined) &&
30+
(searchParams.query === '' || searchParams.query === undefined)
3031
);
3132

33+
useUrlHash('create-ticket', () => openCreateModal());
34+
3235
return (
3336
<PageBody>
3437
<PageTitle>{t`Tickets`}</PageTitle>

frontend/src/components/routes/ticket-widget/SelectTickets/index.tsx

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -345,49 +345,46 @@ const SelectTickets = (props: SelectTicketsProps) => {
345345
</div>
346346
</form>
347347
)}
348-
349-
{ticketAreAvailable && (
350-
<div className={'hi-promo-code-row'}>
351-
{(!showPromoCodeInput && !form.values.promo_code) && (
352-
<Anchor className={'hi-have-a-promo-code-link'}
353-
onClick={() => setShowPromoCodeInput(true)}>
354-
{t`Have a promo code?`}
355-
</Anchor>
356-
)}
357-
{form.values.promo_code && (
358-
<div className={'hi-promo-code-applied'}>
359-
<span><b>{form.values.promo_code}</b> {t`applied`}</span>
360-
<ActionIcon
361-
className={'hi-promo-code-applied-remove-icon-button'}
362-
variant="transparent"
363-
aria-label={t`remove`}
364-
title={t`Remove`}
365-
onClick={() => {
366-
promoCodeEventRefetchMutation.mutate(null)
367-
}}
368-
>
369-
<IconX stroke={1.5} size={20}/>
370-
</ActionIcon>
371-
</div>
372-
)}
373-
{(showPromoCodeInput && !form.values.promo_code) && (
374-
<Group className={'hi-promo-code-input-wrapper'} wrap={'nowrap'} gap={'20px'}>
375-
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
376-
{/*@ts-ignore*/}
377-
<TextInput autoFocus classNames={{input: 'hi-promo-code-input'}} onKeyDown={(event) => {
378-
if (event.key === 'Enter') {
379-
event.preventDefault();
380-
handleApplyPromoCode();
381-
}
382-
}} mb={0} ref={promoRef}/>
383-
<Button disabled={promoCodeEventRefetchMutation.isLoading}
384-
className={'hi-apply-promo-code-button'} variant={'outline'}
385-
onClick={handleApplyPromoCode}>
386-
{t`Apply Promo Code`}
387-
</Button>
388-
</Group>
389-
)}
390-
</div>
348+
<div className={'hi-promo-code-row'}>
349+
{(!showPromoCodeInput && !form.values.promo_code) && (
350+
<Anchor className={'hi-have-a-promo-code-link'}
351+
onClick={() => setShowPromoCodeInput(true)}>
352+
{t`Have a promo code?`}
353+
</Anchor>
354+
)}
355+
{form.values.promo_code && (
356+
<div className={'hi-promo-code-applied'}>
357+
<span><b>{form.values.promo_code}</b> {t`applied`}</span>
358+
<ActionIcon
359+
className={'hi-promo-code-applied-remove-icon-button'}
360+
variant="transparent"
361+
aria-label={t`remove`}
362+
title={t`Remove`}
363+
onClick={() => {
364+
promoCodeEventRefetchMutation.mutate(null)
365+
}}
366+
>
367+
<IconX stroke={1.5} size={20}/>
368+
</ActionIcon>
369+
</div>
370+
)}
371+
</div>
372+
{(showPromoCodeInput && !form.values.promo_code) && (
373+
<Group className={'hi-promo-code-input-wrapper'} wrap={'nowrap'} gap={'20px'}>
374+
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
375+
{/*@ts-ignore*/}
376+
<TextInput autoFocus classNames={{input: 'hi-promo-code-input'}} onKeyDown={(event) => {
377+
if (event.key === 'Enter') {
378+
event.preventDefault();
379+
handleApplyPromoCode();
380+
}
381+
}} mb={0} ref={promoRef}/>
382+
<Button disabled={promoCodeEventRefetchMutation.isLoading}
383+
className={'hi-apply-promo-code-button'} variant={'outline'}
384+
onClick={handleApplyPromoCode}>
385+
{t`Apply Promo Code`}
386+
</Button>
387+
</Group>
391388
)}
392389
{
393390
/**

0 commit comments

Comments
 (0)