Skip to content

Commit

Permalink
feat: display description
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcath committed Jan 29, 2024
1 parent a9811e5 commit 0aab88d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 32 deletions.
8 changes: 1 addition & 7 deletions app/routes/admin.live.add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@ import {
type ActionFunctionArgs,
type LoaderFunctionArgs,
json,
redirect,
unstable_parseMultipartFormData,
unstable_composeUploadHandlers,
unstable_createFileUploadHandler,
unstable_createMemoryUploadHandler
redirect
} from '@remix-run/node'
import {invariant} from '@arcath/utils'
import {v4 as uuid} from 'uuid'
import path from 'path'

import {getUserFromUPN, getUPNFromHeaders} from '~/lib/user.server'
import {getPrisma} from '~/lib/prisma'
Expand Down
20 changes: 1 addition & 19 deletions app/routes/admin.live.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
import {
type LoaderFunctionArgs,
type ActionFunctionArgs,
json,
redirect,
type HeadersArgs
} from '@remix-run/node'
import {type LoaderFunctionArgs, json, type HeadersArgs} from '@remix-run/node'
import {useLoaderData, Outlet} from '@remix-run/react'
import {invariant} from '@arcath/utils'

import {getUPNFromHeaders, getUserFromUPN} from '~/lib/user.server'
import {getPrisma} from '~/lib/prisma'
import {createTimings, combineServerTimingHeaders} from '~/utils/timings.server'

import {log} from '~/log.server'

import {
fieldsetClasses,
labelClasses,
inputClasses,
buttonClasses,
labelSpanClasses,
labelInfoClasses
} from '~/lib/classes'

export const loader = async ({request}: LoaderFunctionArgs) => {
const {time, getHeader} = createTimings()

Expand Down
15 changes: 14 additions & 1 deletion app/routes/live.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {getUPNFromHeaders, getUserFromUPN} from '~/lib/user.server'
import {getConfigValue} from '~/lib/config.server'
import {getPrisma} from '~/lib/prisma'
import {buttonClasses} from '~/lib/classes'
import {getMDXComponent} from '~/lib/mdx'

export const loader = async ({request}: LoaderFunctionArgs) => {
const user = await getUserFromUPN(getUPNFromHeaders(request))
Expand Down Expand Up @@ -69,12 +70,24 @@ const Live = () => {

if (!start) {
return (
<div className="mx-96 bg-white rounded-xl p-2 shadow-xl mt-12 grid grid-cols-3">
<div className="mx-96 bg-white rounded-xl p-2 shadow-xl mt-12 grid grid-cols-2 gap-4">
<h3 className="text-xl col-span-3">Live Streams</h3>
{streams.length === 0 ? (
<div className="col-span-3 text-center">
<i>There are no streams currently running.</i>
</div>
) : (
''
)}
{streams.map(stream => {
const Description = getMDXComponent(stream.descriptionCache)

return (
<div key={stream.id} className="text-center my-2">
<h4 className="text-lg mb-2">{stream.title}</h4>
<div className="mb-4">
<Description />
</div>
<button
className={buttonClasses()}
onClick={() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "LiveStream" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
12 changes: 7 additions & 5 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ model Incident {
}

model LiveStream {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
title String
live Boolean @default(false)
key String @unique
description String @default("")
descriptionCache String @default("")
live Boolean @default(false)
key String @unique
description String @default("")
descriptionCache String @default("")
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
}

0 comments on commit 0aab88d

Please sign in to comment.