-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial React Frontend #1819
Initial React Frontend #1819
Conversation
* Add initial react frontend to be deployed via github pages. * Include GitHub action to deploy site. * Base is set to `/helm/` to align with current deployment * Enviroment variables will need to be set in CI: - VITE_HELM_BENCHMARKS_ENDPOINT - VITE_HELM_BENCHMARKS_SUITE * Routes make use of `HashRouter`
Can be viewed on the forked branch here: |
This is awesome, thank you! I'll send you a review in a day or two :) |
Great work - thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this is taking me longer to review than expected, but I left some initial comments first.
src/helm-frontend/src/App.css
Outdated
@tailwind utilities; | ||
|
||
/** | ||
* @TODO move me to component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this to the components now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is a bit of an odd one. I added that comment originally for a reminder to look into potentially moving those styles to the components and neglected to remove it. I was unable to uncover a method to do that without introducing significant additional complexity. I am open to suggestions you may have as it is very possible I am not aware of ways to make that happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I'm fine with having this be here. We don't have very much component-specific CSS anyway.
"types": ["vitest/globals", "vite/client"] | ||
}, | ||
"include": ["src"], | ||
"references": [{ "path": "./tsconfig.node.json" }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused how the references
field here works, and also the include
field in tsconfig.node.json
... could you give a quick explanation or link for my benefit? Or is this auto-generated scaffolding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does appear to be part of the template when creating the project:
I am not sure why the node specific config needs to referenced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, if it's auto-generated, then it should be okay. Maybe I will investigate further later.
src/helm-frontend/src/types/Stat.ts
Outdated
prob: number; | ||
robustness: boolean; | ||
source_class: string; | ||
target_class: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if TypeScript supports this, but perturbation could contain extra fields of arbitrary type.
Also I think this definition can be combined with the Perturbation.ts
earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I admittedly did a bit of best guessing with some of these types. Were you thinking about something like this?
export default interface Perturbation {
[key: string]: string | number | boolean | undefined;
name?: string;
display_name?: string;
description?: string;
computed_on?: string;
fairness?: boolean;
name_file_path?: string;
person_name_type?: string;
preserve_gender?: boolean;
prob?: number;
robustness?: boolean;
source_class?: string;
target_class?: string;
}
And then using that type in types/Stat
?
That would have the benefit of still providing some additional hinting within the IDE, while still allowing for additional values.
In a related note, I did notice that there are several typos where Perturbation is written as Peturbation. I will update that once we align on the best path forward here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think [key: string]: string | number | boolean | undefined;
is a good idea. And it would be a good idea to resolve the typos as well.
No problem! Thank you for the feedback and I'll address those for tomorrow. |
* Fix MarkdownValue test filename * Correct semantic markdown on homepage lists * Fix `GroupMetaData` typo * Fix `IMetric` typo * Remove incorrect readme info about pre-built static files * Add `paths` filter to only test and build within `src/helm-frontend`
* Remove incorrect readme info about pre-built static files (this was missed in previous commit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, I got pre-empted by other things. Almost done with the review; only have a few components left to look through, which I should be able to finish up tomorrow.
|
||
return await displayPrediction.json() as DisplayPrediction[]; | ||
} catch (error) { | ||
console.log(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.error
instead of console.log
(same for the other services).
src/helm-frontend/src/App.css
Outdated
@tailwind utilities; | ||
|
||
/** | ||
* @TODO move me to component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I'm fine with having this be here. We don't have very much component-specific CSS anyway.
"types": ["vitest/globals", "vite/client"] | ||
}, | ||
"include": ["src"], | ||
"references": [{ "path": "./tsconfig.node.json" }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, if it's auto-generated, then it should be okay. Maybe I will investigate further later.
src/helm-frontend/src/types/Stat.ts
Outdated
prob: number; | ||
robustness: boolean; | ||
source_class: string; | ||
target_class: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think [key: string]: string | number | boolean | undefined;
is a good idea. And it would be a good idea to resolve the typos as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is nearly ready for merging; just have some minor stuff left. I'm okay with punting some stuff to future PRs, if desired.
value: string; | ||
} | ||
|
||
export default function PreView({ value }: Props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Preview
instead of PreView
(same for file name)
{subGroups.filter((subGroup) => | ||
(topLevelGroup.subgroups || []).includes(subGroup.name) | ||
).map((subGroup, idx) => ( | ||
subGroup.todo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can just do const classNames = subGroup.todo ? "ml-4 text-slate-300" : "ml-4"
since the rest of the element is the same
Hi Mike, I am thinking of merging the current as is, because this would allow other folks to start playing around with the React Frontend and building on top of it. The remaining suggestions can be resolved in a subsequent PR. WDYT? |
Fix typos and cleanup * Fix naming typos * Update npm package for security warning * Remove leftover comments
I pushed some additional adjustments based on the review discussion. Please feel free to merge this in at any time. Thank you again for all your time to review the work. |
As a reminder, this line will need to be adjusted in the CI/CD Github action for moving to the main branch for deployment. I did not change it because if I did this branch would no build the example site for review. |
Sounds good, I will change the branch name for CI/CD in a separate PR. Thanks again! |
Merged - and this is one of the biggest PRs we've merged so far. Congrats and thanks again @mkly ! |
Thank you for the great work, @mkly ! |
/helm/
to align with current deploymentHashRouter