-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ugly hack for dashboard auto refresh (#42)
* Update application form * Add ugly hack for dashboard auto refresh The MarkDownRenderer is a server component as it needs direct access to the database for render context. A nice auto refresh would need to be implemented client side as only part of the page needs to be re-rendered. Switching MarkDownRenderer to be a client component is simply too much work that I'm not willing to commit to so I've resorted back to this ugly hack of server rendering a `<script>` tag that just refreshes the entire page every minute. Thank Sneh for all the work he did on this!
- Loading branch information
Showing
2 changed files
with
9 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -6,7 +6,6 @@ import Image from 'next/image' | |
|
||
import { Box } from '@/components/Box' | ||
import { LinkButton } from '@/components/Button' | ||
import { Header } from '@/components/Header' | ||
import { Heading } from '@/components/Heading' | ||
import { Organizer, OrganizerProps } from '@/components/Organizer' | ||
import clientPromise from '@/lib/db' | ||
|
@@ -151,7 +150,7 @@ async function Dashboard({ user }: { user: JsonUser }) { | |
|
||
// Generate check-in PIN | ||
if (user.checkInPin === undefined) { | ||
const pin = randomInt(100_000, 999_999) | ||
const pin = randomInt(1000, 9999) | ||
await client | ||
.db() | ||
.collection<User>('users') | ||
|
@@ -185,7 +184,8 @@ async function Dashboard({ user }: { user: JsonUser }) { | |
children = [ | ||
<p key="kid"> | ||
We've received your application. Check back later to see if you get | ||
accepted, and feel free to contact the organizers if you need any | ||
accepted, and feel free to contact the organizers at{' '} | ||
<a href="mailto:[email protected]">[email protected]</a> if you need any | ||
assistance! | ||
</p>, | ||
] | ||
|
@@ -209,6 +209,11 @@ async function Dashboard({ user }: { user: JsonUser }) { | |
> | ||
{...children} | ||
</Box> | ||
<div | ||
dangerouslySetInnerHTML={{ | ||
__html: `<!-- hey you found my ugly hack! --><script>setInterval(() => window.location.reload(), 60_000)</script>`, | ||
}} | ||
></div> | ||
</Box> | ||
) | ||
} |