@@ -3,21 +3,33 @@ import Head from "next/head";
33import { InferGetServerSidePropsType } from "next" ;
44import styled from "@emotion/styled" ;
55import { Client , NodeReportCoverage } from "@codetest/editor-client" ;
6- import { CircleIcon } from "@radix-ui/react-icons" ;
7-
6+ import { CircleIcon , LightningBoltIcon , CodeIcon } from "@radix-ui/react-icons" ;
7+ import { IconButton } from "@code-editor/ui" ;
88type P = InferGetServerSidePropsType < typeof getServerSideProps > ;
99
10- export default function ReportPage ( { data } : P ) {
10+ export default function ReportPage ( { _key, data } : P ) {
11+ const onRegenerate = ( ) => {
12+ alert ( "regenerate (not implemented)" ) ;
13+ } ;
14+
1115 return (
1216 < >
1317 < Head >
1418 < title > Report Coverages - @codetest/reports</ title >
1519 { /* */ }
1620 </ Head >
1721 < Main >
18- < h1 >
19- < code > @codetest/reports</ code >
20- </ h1 >
22+ < header className = "header" >
23+ < span >
24+ < code > @codetest/reports</ code >
25+ < h1 > { _key } </ h1 >
26+ </ span >
27+ < div >
28+ < IconButton title = "regenerate" onClick = { onRegenerate } >
29+ < LightningBoltIcon />
30+ </ IconButton >
31+ </ div >
32+ </ header >
2133 { /* <code>
2234 <pre>{JSON.stringify(data, null, 2)}</pre>
2335 </code> */ }
@@ -34,6 +46,7 @@ export default function ReportPage({ data }: P) {
3446}
3547
3648const Main = styled . main `
49+ color: white;
3750 font-family: monospace;
3851 width: 400px;
3952 margin: auto;
@@ -45,6 +58,23 @@ const Main = styled.main`
4558 gap: 16px;
4659 }
4760
61+ header.header {
62+ margin: 120px 0 40px 0;
63+ display: flex;
64+ align-items: center;
65+ justify-content: space-between;
66+
67+ h1 {
68+ margin: 0;
69+ }
70+
71+ .actions {
72+ display: flex;
73+ align-items: center;
74+ gap: 4px;
75+ }
76+ }
77+
4878 footer {
4979 height: 200px;
5080 }
@@ -53,13 +83,29 @@ const Main = styled.main`
5383function Item ( { id, a, b, diff, report } : NodeReportCoverage & { id : string } ) {
5484 const [ focus , setFocus ] = React . useState < "a" | "b" | null > ( null ) ;
5585
86+ const onInspect = ( ) => {
87+ alert ( "inspect (not implemented)" ) ;
88+ } ;
89+
90+ const onRegenerate = ( ) => {
91+ alert ( "regenerate (not implemented)" ) ;
92+ } ;
93+
5694 return (
5795 < ItemContainer >
5896 < header >
5997 < p className = "title" >
6098 < CircleIcon />
6199 { id } { focus && < span > ({ focus } )</ span > }
62100 </ p >
101+ < div className = "actions" >
102+ < IconButton title = "inspect" onClick = { onInspect } >
103+ < CodeIcon />
104+ </ IconButton >
105+ < IconButton title = "regenerate" onClick = { onRegenerate } >
106+ < LightningBoltIcon />
107+ </ IconButton >
108+ </ div >
63109 </ header >
64110 < div className = "view" data-focus = { focus } >
65111 < img className = "a" src = { a } alt = "A" />
@@ -92,12 +138,23 @@ const ItemContainer = styled.div`
92138 height: 100%;
93139
94140 header {
141+ color: white;
142+ display: flex;
143+ flex-direction: row;
144+ align-items: center;
145+ justify-content: space-between;
95146 padding: 16px;
96147 .title {
97148 display: flex;
98149 align-items: center;
99150 gap: 8px;
100151 }
152+
153+ .actions {
154+ display: flex;
155+ align-items: center;
156+ gap: 4px;
157+ }
101158 }
102159
103160 .view {
@@ -173,6 +230,7 @@ export async function getServerSideProps(context: any) {
173230
174231 return {
175232 props : {
233+ _key : key ,
176234 data,
177235 } ,
178236 } ;
0 commit comments