feat: implement signup dialog for event registration
Added a new signup dialog component that opens when users click on signup links. The dialog fetches and displays the signup form dynamically, enhancing user experience. Updated styles for the dialog and integrated it into the public schedule page. Adjusted asset loading rules to accommodate the new functionality.
This commit is contained in:
1 parent
df3165f6a8
commit
1f451dc830
5 files changed
+401
-8
No files matched your search
+19
-2
@@ -543,10 +543,27 @@ function PublicSchedule(props: {
|
||||
) : (
|
||||
<WednesdayBoard config={props.config} event={props.event} now={props.now} />
|
||||
)}
|
||||
<SignupDialog config={props.config} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SignupDialog(props: { config: AppConfig }) {
|
||||
return (
|
||||
<>
|
||||
<dialog id="signup-dialog" class="event-dialog" aria-labelledby="signup-dialog-label">
|
||||
<div class="event-dialog-card signup-dialog-card">
|
||||
<button type="button" class="event-dialog-close signup-dialog-close" data-signup-close aria-label="Close">
|
||||
<img src={asset(props.config, '/img/icons/close.svg')} alt="" />
|
||||
</button>
|
||||
<div id="signup-dialog-body"></div>
|
||||
</div>
|
||||
</dialog>
|
||||
<script src={asset(props.config, '/js/signup-dialog.js')} defer />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
type WednesdayGroup = {
|
||||
date: string;
|
||||
heading: string;
|
||||
@@ -622,7 +639,7 @@ function ShiftPane(props: { config: AppConfig; shift: PublicShift }) {
|
||||
<span>Not accepting more signups</span>
|
||||
</p>
|
||||
) : (
|
||||
<a class="btn-card" href={appPath(props.config, `/s/${shift.id}`)}>
|
||||
<a class="btn-card" href={appPath(props.config, `/s/${shift.id}`)} data-signup={closed ? undefined : ''}>
|
||||
{action}
|
||||
<img src={asset(props.config, '/img/icons/right-arrow.svg')} alt="" />
|
||||
</a>
|
||||
@@ -794,7 +811,7 @@ function CalendarShift(props: { config: AppConfig; shift: PublicShift }) {
|
||||
const closed = shift.full || shift.cancelled || shift.ended;
|
||||
const action = closed ? 'View shift' : 'Sign up';
|
||||
return (
|
||||
<a class="cal-shift" href={appPath(props.config, `/s/${shift.id}`)}>
|
||||
<a class="cal-shift" href={appPath(props.config, `/s/${shift.id}`)} data-signup={closed ? undefined : ''}>
|
||||
<span class="cal-line">
|
||||
{shift.when.startLabel} {shift.role}
|
||||
</span>
|
||||
|
||||
@@ -15,7 +15,7 @@ const ASSET_ROOTS = ['css', 'brand', 'img', 'js'];
|
||||
|
||||
/**
|
||||
* Same-origin GET links are fetched on hover.
|
||||
* Confirm and new-event controls open a dialog instead of navigating.
|
||||
* Confirm, new-event, and signup controls open a dialog instead of navigating.
|
||||
* Cross-origin links are not eligible unless a rule asks for them.
|
||||
*/
|
||||
export const SPECULATION_RULES = {
|
||||
@@ -25,7 +25,7 @@ export const SPECULATION_RULES = {
|
||||
where: {
|
||||
and: [
|
||||
{ href_matches: '/*' },
|
||||
{ not: { selector_matches: '[data-confirm], [data-open-event]' } },
|
||||
{ not: { selector_matches: '[data-confirm], [data-open-event], [data-signup]' } },
|
||||
],
|
||||
},
|
||||
eagerness: 'moderate',
|
||||
|
||||
Reference in new issue
Block a user