Skip to content

Commit

Permalink
vod url
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoishin committed Jun 12, 2024
1 parent fefa1bd commit a7c99ac
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
28 changes: 20 additions & 8 deletions app/routes/_base.events.$eventName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const loader = async ({
category: true,
playedWith: true,
startsAt: true,
vodUrl: true,
},
orderBy: { startsAt: "asc" },
}),
Expand Down Expand Up @@ -48,14 +49,25 @@ export default () => {
</tr>
</thead>
<tbody>
{runs.map((run) => (
<tr key={run.id}>
<td>{new Date(run.startsAt).toLocaleString()}</td>
<td>{run.translatedName ?? run.originalName}</td>
<td>{run.category}</td>
<td>{run.playedWith}</td>
</tr>
))}
{runs.map((run) => {
const name = run.translatedName ?? run.originalName;
return (
<tr key={run.id}>
<td>{new Date(run.startsAt).toLocaleString()}</td>
<td>
{run.vodUrl ? (
<a href={run.vodUrl} target="_blank" rel="noreferrer">
{name}
</a>
) : (
name
)}
</td>
<td>{run.category}</td>
<td>{run.playedWith}</td>
</tr>
);
})}
</tbody>
</table>
</>
Expand Down
3 changes: 3 additions & 0 deletions app/routes/admin.$/resources/runs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
SimpleForm,
TextField,
TextInput,
UrlField,
} from "react-admin";

import { Datagrid, Edit } from "../components/override";
Expand All @@ -24,6 +25,7 @@ const RunsList = () => (
<TextField source="category" />
<TextField source="playedWith" />
<DateField source="startsAt" showTime />
<UrlField source="vodUrl" />
</Datagrid>
</List>
);
Expand All @@ -37,6 +39,7 @@ const RunsEdit = () => (
<TextInput source="category" />
<TextInput source="playedWith" />
<DateTimeInput source="startsAt" />
<TextInput source="vodUrl" />
</SimpleForm>
</Edit>
);
Expand Down
2 changes: 2 additions & 0 deletions migrations/0011_add-vodUrl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Runs" ADD COLUMN "vodUrl" TEXT;
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ model Runs {
playedWith String?
startsAt DateTime
syncExternalId String?
vodUrl String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Expand Down

0 comments on commit a7c99ac

Please sign in to comment.