Skip to content

Commit

Permalink
Bump review-ui @saferplace/api to 0.0.19 (#233)
Browse files Browse the repository at this point in the history
This required a few more changes as the APIs has changed.
  • Loading branch information
VoyTechnology authored Oct 13, 2023
1 parent b7c8e5b commit 5c00719
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/review-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.12",
"@mui/material": "^5.14.9",
"@saferplace/api": "^0.0.18",
"@saferplace/api": "^0.0.19",
"leaflet": "^1.9.4",
"oidc-react": "^3.2.2",
"react": "^18.2.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/review-ui/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { CssBaseline } from '@mui/material'
import React from 'react'
import ReactDOM from 'react-dom/client'
import { createBrowserRouter, LoaderFunctionArgs, RouterProvider } from 'react-router-dom'
import Incident, { Props } from './routes/incident'
import IncidentView, { Props } from './routes/incident'
import Pending from './routes/pending'
import Root from './routes/root'
import { ReviewService } from '@saferplace/api/review/v1/review_connect'
import { BasicIncidentDetails } from '@saferplace/api/review/v1/review_pb'
import ErrorPage from './routes/error'

import { createPromiseClient, Interceptor } from '@bufbuild/connect'
import { createConnectTransport } from '@bufbuild/connect-web'
import { Incident } from '@saferplace/api/incident/v1/incident_pb'

const addReviewerEmailInterceptor: Interceptor = (next) => async (req) => {
req.header.set('email', localStorage.getItem('email') ?? '')
Expand All @@ -25,7 +25,7 @@ const client = createPromiseClient(
}),
)

async function pendingLoader(): Promise<BasicIncidentDetails[]> {
async function pendingLoader(): Promise<Incident[]> {
const res = await client.incidentsWithoutReview({})
return res.incidents
}
Expand All @@ -49,7 +49,7 @@ const router = createBrowserRouter([
loader: pendingLoader,
}, {
path: 'incident/:id',
element: <Incident />,
element: <IncidentView />,
loader: incidentLoader,
}
],
Expand Down
2 changes: 1 addition & 1 deletion packages/review-ui/src/routes/incident.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function Review({incident, onSubmit}: Props) {
/>
<TextField
label='Time Submitted'
value={new Date(Number(incident.timestamp) * 1000)}
value={incident.timestamp?.toDate().toString()}
disabled
fullWidth
margin='normal'
Expand Down
7 changes: 3 additions & 4 deletions packages/review-ui/src/routes/pending.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Card, CardContent, CardHeader, Stack, Typography } from '@mui/material'
import React from 'react'
import { useLoaderData, Link } from 'react-router-dom'
import { BasicIncidentDetails } from '@saferplace/api/review/v1/review_pb'
import { ArrowForwardIos } from '@mui/icons-material'
import { Incident } from '@saferplace/api/incident/v1/incident_pb'

export default function Pending() {
const incidents = useLoaderData() as BasicIncidentDetails[]
const incidents = useLoaderData() as Incident[]
return (
<Stack spacing={1}>
<Typography variant='h4'>Incidents Pending Review</Typography>
Expand All @@ -18,8 +18,7 @@ export default function Pending() {
>
<CardHeader
action={<ArrowForwardIos />}
title={new Date(Number(incident.timestamp) * 1000).toString()}
subheader={(new Date(Number(incident.timestamp) * 1000)).toString()}
title={incident.timestamp?.toDate().toString()}
/>
<CardContent>

Expand Down
24 changes: 13 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5c00719

Please sign in to comment.