-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat(tags): added tags to ai lab recipes #2522
base: main
Are you sure you want to change the base?
Conversation
@gastoner can you please add screenshots and/or video of the changes? |
Yes, when it is done I will, it is not done yet |
67196a7
to
e2bab2d
Compare
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
e2bab2d
to
99df990
Compare
79464d9
to
33c1413
Compare
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
33c1413
to
33bebc5
Compare
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.
@gastoner thank you for the screenshot! One question to clarify the behavior: so when a user presses 2 more
, and one card expends, will the other cards in the same row expand as well?
No, only the card that was clicked will expand |
@MariaLeonova which colors should I use for the tags (text and background) for the light/dark theme respectively? |
@gastoner these were the initial proposed colors: |
Needs to be merged after podman-desktop/podman-desktop#11213 - colors for AI Lab Tags |
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
c2f6c86
to
dafd638
Compare
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.
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.
LGTM on my side
Since we are depending on Podman Desktop colors merged in (podman-desktop/podman-desktop#11213)
We need to update the minimum version we need to run on
"podman-desktop": ">=1.8.0" |
io.podman-desktop.api.version=">= 1.8.0" |
to 1.17.0.
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
content: string; | ||
backgroundColor?: string; | ||
textColor?: string; | ||
className?: 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.
use class
the in the props do class: className
, so we use traditional props
interface Props { | ||
icon?: IconDefinition; | ||
content: string; | ||
backgroundColor?: 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.
Do we really need to use backgroundColor? I feel like this should be included in the class
prop?
class ResizeObserver { | ||
observe = vi.fn(); | ||
disconnect = vi.fn(); | ||
unobserve = vi.fn(); | ||
} | ||
|
||
beforeAll(() => { | ||
Object.defineProperty(window, 'ResizeObserver', { value: ResizeObserver }); |
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.
We should move the ResizeObserver to the setup.vitest.js to avoid repeating it everywhere? (can be a follow up)
const useCases = ['natural-language-processing', 'audio', 'computer-vision']; | ||
const languages = ['java', 'javascript', 'python']; | ||
const frameworks = ['langchain', 'langchain4j', 'quarkus', 'react', 'streamlit', 'vectordb']; | ||
const tools = ['none', 'llama-cpp', 'whisper-cpp']; | ||
|
||
const tags: string[] = [ | ||
...recipe.categories, | ||
...(recipe.backend !== undefined ? [recipe.backend] : []), | ||
...(recipe.frameworks ?? []), | ||
...(recipe.languages ?? []), | ||
]; |
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.
Can we move this to a dedicated constants / tags-constant / please find a nice name file ? as those are constants ? (user uppercase for constants
if (useCases.includes(tag)) { | ||
return 'bg-[var(--pd-label-primary-bg)]'; | ||
} else if (languages.includes(tag)) { | ||
return 'bg-[var(--pd-label-secondary-bg)]'; | ||
} else if (frameworks.includes(tag)) { | ||
return 'bg-[var(--pd-label-tertiary-bg)]'; | ||
} else if (tools.includes(tag)) { | ||
return 'bg-[var(--pd-label-quaternary-bg)]'; | ||
} | ||
return 'bg-[var(--pd-label-primary-bg)]'; |
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 is computation heavy, lot of includes O(n * count) (with count number of condition check).
You could create a map such as
const TAG_BG_COLOR = new Map([
...useCases.map((useCase) => [useCase, 'bg-[var(--pd-label-primary-bg)]']),
...languages.map((useCase) => [useCase, 'bg-[var(--pd-label-secondary-bg)]']),
...frameworks.map((useCase) => [useCase, 'bg-[var(--pd-label-tertiary-bg)]']),
...tools.map((useCase) => [useCase, 'bg-[var(--pd-label-quaternary-bg)]']),
]);
and determineBackgroundColor
became
function determineBackgroundColor(tag: string): string {
return TAG_BG_COLOR.get(tag) ?? 'bg-[var(--pd-label-primary-bg)]';
}
Please the TAG_BG_COLOR should be created in a dedicated constants file, creating a map in each component would waste resources
Same for the text colors
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.
Okay, so in todays daily, I mention this PR, and how it depends on colors, that will be available only in podman desktop >= 1.17
@jeffmaury confirmed, that we should do one of the following
- hardcode the colors in the tailwindcss to avoid having this hard dependency on a recent version of podman-desktop (Because we want to release ai-lab 1.5 before podman desktop 1.17).
- Delay this PR for next release (ai-lab 1.6).
I would rather have the colors hardcoded (at least for the 1.5, and have an issue created with a 1.6 milestone, to remove those hardcoded colors)
I agree, I don't want to hard-code colors. So I would (since the colors are merged already):
|
05d528e
to
875d02d
Compare
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
875d02d
to
5441cd3
Compare
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.
Looks good from the UX POV.
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
What does this PR do?
Adds tags to recipes in AI lab
Screenshot / video of UI
What issues does this PR fix or reference?
Closes #2104
How to test this PR?
Use this PR merging to PD podman-desktop/podman-desktop#11213 in combination with this PR, otherwise you wont see the colors
Go to recipes in ai lab