11import "react-reflex/styles.css" ;
22
3- import { Theme , createStyles , makeStyles } from "@material-ui/core/styles" ;
43import { Link } from "@tanstack/react-router" ;
54import { CircleX , MessageCircleWarning } from "lucide-react" ;
65
@@ -21,64 +20,20 @@ export const ERROR_SOURCE_TO_ITEM = {
2120 [ DeveloperError_Source . UNKNOWN_SOURCE ] : undefined ,
2221} ;
2322
24- const useErrorDisplayStyles = makeStyles ( ( theme : Theme ) =>
25- createStyles ( {
26- validationError : {
27- border : 0 ,
28- } ,
29- foundVia : {
30- marginTop : theme . spacing ( 1 ) ,
31- } ,
32- foundViaList : {
33- margin : 0 ,
34- fontFamily : "Roboto Mono, monospace" ,
35- listStyleType : "none" ,
36- "& li::after" : {
37- content : '" →"' ,
38- } ,
39- "& li:last-child::after" : {
40- content : '""' ,
41- } ,
42- } ,
43- editorContainer : {
44- display : "grid" ,
45- alignItems : "center" ,
46- gridTemplateColumns : "auto 1fr" ,
47- } ,
48- dot : {
49- display : "inline-block" ,
50- marginRight : theme . spacing ( 1 ) ,
51- borderRadius : "50%" ,
52- width : "8px" ,
53- height : "8px" ,
54- } ,
55- progress : {
56- color : theme . palette . text . primary ,
57- } ,
58- success : {
59- color : theme . palette . success . main ,
60- } ,
61- gray : {
62- color : theme . palette . grey [ 500 ] ,
63- } ,
64- warning : {
65- color : theme . palette . warning . main ,
66- } ,
67- } ) ,
68- ) ;
69-
7023export function DeveloperErrorDisplay ( { error } : { error : DeveloperError } ) {
71- const classes = useErrorDisplayStyles ( ) ;
7224 return (
7325 < Alert variant = "destructive" >
7426 < CircleX />
7527 < AlertTitle > { error . message } </ AlertTitle >
7628 { error . path . length > 0 && (
7729 < AlertDescription >
7830 Found Via:
79- < ul className = { classes . foundViaList } >
31+ < ul className = "" >
8032 { error . path . map ( ( item ) => (
81- < li key = { item } > { item } </ li >
33+ // NOTE: the \2192 here is the → character; tailwind needs it as an escape sequence.
34+ < li className = "after:content-['\2192'] after:ml-2 last:after:content-none" key = { item } >
35+ { item }
36+ </ li >
8237 ) ) }
8338 </ ul >
8439 </ AlertDescription >
@@ -96,72 +51,42 @@ export function DeveloperWarningDisplay({ warning }: { warning: DeveloperWarning
9651 ) ;
9752}
9853
99- const useSourceDisplayStyles = makeStyles ( ( theme : Theme ) =>
100- createStyles ( {
101- link : {
102- color : theme . palette . text . primary ,
103- } ,
104- validationErrorContext : {
105- padding : theme . spacing ( 1 ) ,
106- backgroundColor : theme . palette . background . default ,
107- } ,
108- } ) ,
109- ) ;
110-
11154export function DeveloperWarningSourceDisplay ( { warning } : { warning : DeveloperWarning } ) {
112- const classes = useSourceDisplayStyles ( ) ;
113-
11455 return (
115- < div className = { classes . validationErrorContext } >
56+ < div className = "m-2" >
11657 In
117- < Link className = { classes . link } to = { DataStorePaths . Schema ( ) } >
118- Schema
119- </ Link >
58+ < Link to = { DataStorePaths . Schema ( ) } > Schema</ Link >
12059 { /* NOTE: this is a guess; I think this was an unintentional omission. */ } : { warning . message }
12160 </ div >
12261 ) ;
12362}
12463
12564export function DeveloperSourceDisplay ( { error } : { error : DeveloperError } ) {
126- const classes = useSourceDisplayStyles ( ) ;
127-
12865 // TODO: unify with error source above.
12966 return (
13067 < div >
13168 { error . source === DeveloperError_Source . SCHEMA && (
132- < div className = { classes . validationErrorContext } >
69+ < div className = "m-2" >
13370 In
134- < Link className = { classes . link } to = { DataStorePaths . Schema ( ) } >
135- Schema
136- </ Link >
137- :
71+ < Link to = { DataStorePaths . Schema ( ) } > Schema</ Link > :
13872 </ div >
13973 ) }
14074 { error . source === DeveloperError_Source . ASSERTION && (
141- < div className = { classes . validationErrorContext } >
75+ < div className = "m-2" >
14276 In
143- < Link className = { classes . link } to = { DataStorePaths . Assertions ( ) } >
144- Assertions
145- </ Link >
146- :
77+ < Link to = { DataStorePaths . Assertions ( ) } > Assertions</ Link > :
14778 </ div >
14879 ) }
14980 { error . source === DeveloperError_Source . RELATIONSHIP && (
150- < div className = { classes . validationErrorContext } >
81+ < div className = "m-2" >
15182 In
152- < Link className = { classes . link } to = { DataStorePaths . Relationships ( ) } >
153- Test Data
154- </ Link >
155- :
83+ < Link to = { DataStorePaths . Relationships ( ) } > Test Data</ Link > :
15684 </ div >
15785 ) }
15886 { error . source === DeveloperError_Source . VALIDATION_YAML && (
159- < div className = { classes . validationErrorContext } >
87+ < div className = "m-2" >
16088 In
161- < Link className = { classes . link } to = { DataStorePaths . ExpectedRelations ( ) } >
162- Expected Relations
163- </ Link >
164- :
89+ < Link to = { DataStorePaths . ExpectedRelations ( ) } > Expected Relations</ Link > :
16590 </ div >
16691 ) }
16792 </ div >
0 commit comments