-
Notifications
You must be signed in to change notification settings - Fork 12k
Disable dark mode on the success page only for the organizer #3001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c77c840
disable darkmode only for organizer
ccf4dc0
disable dark mode when user comes from user dashboard
ca6fdf8
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] e4fe83d
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] abf79a5
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] 03d48d8
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] ba80644
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] 90c133d
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] f9bebed
move Theme to shell
ed47ffc
fix build errors
22c1400
sort dates for recurring bookings
7df0a45
new parameter if user comes from booking an event
1e98214
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] cc6b596
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] eb8b897
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] 4481343
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] 1e14fc6
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] e7d5d29
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] 0f0365d
Merge branch 'main' into fix/dark-mode-success-page
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,7 +149,7 @@ type SuccessProps = inferSSRProps<typeof getServerSideProps>; | |
| export default function Success(props: SuccessProps) { | ||
| const { t } = useLocale(); | ||
| const router = useRouter(); | ||
| const { location: _location, name, reschedule, listingStatus, status } = router.query; | ||
| const { location: _location, name, reschedule, listingStatus, status, isSuccessBookingPage } = router.query; | ||
| const location = Array.isArray(_location) ? _location[0] : _location; | ||
| const [is24h, setIs24h] = useState(isBrowserLocale24h()); | ||
| const { data: session } = useSession(); | ||
|
|
@@ -257,7 +257,7 @@ export default function Success(props: SuccessProps) { | |
| return t("emailed_you_and_attendees" + titleSuffix); | ||
| } | ||
| const userIsOwner = !!(session?.user?.id && eventType.users.find((user) => (user.id = session.user.id))); | ||
| const { isReady, Theme } = useTheme(userIsOwner ? "light" : props.profile.theme); | ||
| const { isReady, Theme } = useTheme(isSuccessBookingPage ? props.profile.theme : "light"); | ||
| const title = t( | ||
| `booking_${needsConfirmation ? "submitted" : "confirmed"}${props.recurringBookings ? "_recurring" : ""}` | ||
| ); | ||
|
|
@@ -441,7 +441,7 @@ export default function Success(props: SuccessProps) { | |
| profile={{ name: props.profile.name, slug: props.profile.slug }} | ||
| team={eventType?.team?.name} | ||
| setIsCancellationMode={setIsCancellationMode} | ||
| theme={userIsOwner ? "light" : props.profile.theme} | ||
| theme={isSuccessBookingPage ? props.profile.theme : "light"} | ||
| /> | ||
| ))} | ||
| {userIsOwner && !needsConfirmation && !isCancellationMode && !isCancelled && ( | ||
|
|
@@ -622,10 +622,15 @@ function RecurringBookings({ | |
| }: RecurringBookingsProps) { | ||
| const [moreEventsVisible, setMoreEventsVisible] = useState(false); | ||
| const { t } = useLocale(); | ||
| return !isReschedule && recurringBookings && listingStatus === "upcoming" ? ( | ||
|
|
||
| const recurringBookingsSorted = recurringBookings | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dates for recurring events currently aren't sorted |
||
| ? recurringBookings.sort((a, b) => (dayjs(a).isAfter(dayjs(b)) ? 1 : -1)) | ||
| : null; | ||
|
|
||
| return !isReschedule && recurringBookingsSorted && listingStatus === "upcoming" ? ( | ||
| <> | ||
| {eventType.recurringEvent?.count && | ||
| recurringBookings.slice(0, 4).map((dateStr, idx) => ( | ||
| recurringBookingsSorted.slice(0, 4).map((dateStr, idx) => ( | ||
| <div key={idx} className="mb-2"> | ||
| {dayjs(dateStr).format("MMMM DD, YYYY")} | ||
| <br /> | ||
|
|
@@ -635,16 +640,16 @@ function RecurringBookings({ | |
| </span> | ||
| </div> | ||
| ))} | ||
| {recurringBookings.length > 4 && ( | ||
| {recurringBookingsSorted.length > 4 && ( | ||
| <Collapsible open={moreEventsVisible} onOpenChange={() => setMoreEventsVisible(!moreEventsVisible)}> | ||
| <CollapsibleTrigger | ||
| type="button" | ||
| className={classNames("flex w-full", moreEventsVisible ? "hidden" : "")}> | ||
| {t("plus_more", { count: recurringBookings.length - 4 })} | ||
| {t("plus_more", { count: recurringBookingsSorted.length - 4 })} | ||
| </CollapsibleTrigger> | ||
| <CollapsibleContent> | ||
| {eventType.recurringEvent?.count && | ||
| recurringBookings.slice(4).map((dateStr, idx) => ( | ||
| recurringBookingsSorted.slice(4).map((dateStr, idx) => ( | ||
| <div key={idx} className="mb-2"> | ||
| {dayjs(dateStr).format("MMMM DD, YYYY")} | ||
| <br /> | ||
|
|
@@ -847,6 +852,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { | |
| customInputs: true, | ||
| user: { | ||
| select: { | ||
| id: true, | ||
| name: true, | ||
| email: true, | ||
| }, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new parameter that defines if user is redirected to that page after successfully booking an event
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what situations does this variable turn false?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emrysal always true when it comes from the booking page, but we also redirect to /success from bookingListItem to see the booking details. So it is here to check if we we redirected from the booking page or come from a bookingListItem