-
Notifications
You must be signed in to change notification settings - Fork 5k
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
create ui for the full embedding homepage, without any logic #40251
Conversation
@@ -0,0 +1,47 @@ | |||
import type { Meta, StoryObj } from "@storybook/react"; |
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 may or may not land in master (slack), but for now it's helpful to test all the variants of the UI.
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 have no objection for having this in the repo if it helps with feature development.
@@ -0,0 +1,65 @@ | |||
// eslint-disable-next-line no-restricted-imports | |||
import { List } from "@mantine/core"; |
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'll move this to metabase/ui, see description of PR
type="ordered" | ||
mb="lg" | ||
size="sm" | ||
// TODO: fix this in a better way |
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'll also fix this (I hope there's a easy way with the mantine overrides) when re-exporting List from metabase/ui
Codenotify: Notifying subscribers in CODENOTIFY files for diff 6710930...25fb1b4.
|
|
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 with some minor comments.
|
||
export const EmbedHomepage = () => { | ||
const interactiveEmbeddingQuickStartUrl = useSelector(state => | ||
// eslint-disable-next-line no-unconditional-metabase-links-render -- only visible to admins |
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.
How do you feel about having to apply this everywhere? I feel like I erred on the side of being more cautious than being more relaxed since this is only inconvenient for us, but failing to hide user-facing links could make Metabase looks less polished.
If we allow things like disabling the rule for the whole file, it could be possible there are both links that are visible to end users and admins in the same file, though it might never happen.
And I think we only have to do this a handful of times per feature. There are less than 10 inline comments if I count this correctly.
Any feedback would be welcome.
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.
it could be possible there are both links that are visible to end users and admins in the same file, though it might never happen.
Yeah that was my thought to, it may happen, maybe not, but it could. Adding the disable-next-line is a relatively low effort as the editor will do it for me so I'm fine with it
interactiveEmbeddingQuickstartUrl={interactiveEmbeddingQuickStartUrl} | ||
embeddingDocsUrl={embeddingDocsUrl} | ||
// eslint-disable-next-line no-unconditional-metabase-links-render -- only visible to admins | ||
customerFacingAnalyticsDocsUrl="https://www.metabase.com/learn/customer-facing-analytics/" |
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.
The name feels a bit off. The comment suggests this link is only for admin, but the name suggests it's a user-facing string which, in theory, should be rendered conditionally.
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.
Uhm interesting, I haven't thought of that prop as possibly being read like that, would it be better as analyticsDocsUrl
?
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 to me.
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.
25fb1b4 ✅
exampleDashboardId={1} | ||
embeddingAutoEnabled={false} | ||
licenseActiveAtSetup={true} | ||
plan="oss-starter" |
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.
Should we add comments that these values should be from, if I'm not mistaken, settings?
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.
That prop will be calculated in this component the same way as the urls, so it's kind of a "private prop".
It should make more sense in the following PRs, I should have left a comment that the values were temporarily hardcoded though
|
||
<Text fw="bold" mb="md">{t`The TL;DR:`}</Text> | ||
|
||
<List |
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.
What are the reasons/benefits for using List
here? I mean I understand Mantine has it, but this doesn't look anything different from using simple ol
and li
tags. If we need to use icons then maybe I could understand we might need List
but that doesn't seem to be the case 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.
Yeah itt felt overkill to me too but right now we have a reset that removes the list type, so we'd have to make a styled(ol)
/css class with
list-style-type: decimal;
list-style-position: inside;
I did it for the minimal embedding card but it felt like it should have been a re-usable component.
It should also help with making sure spacing, font sizes etc are consistent
exampleDashboardId, | ||
licenseActiveAtSetup, | ||
learnMoreInteractiveEmbedUrl, | ||
} = 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.
If we don't need to spread props like in frontend/src/metabase/home/components/EmbedHomepage/EmbedHomepageView.tsx
what do you think about destructuring these props in the function arguments instead for consistency?
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.
19d2486 ✅
// TODO: fix this in a better way | ||
style={{ listStyleType: "decimal" }} | ||
> | ||
{licenseActiveAtSetup === false && ( |
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 feel like booleans that could be undefined would be a bit awkward when the default value should be true. I'm not sure if that's the case, but the structure suggests so.
The reason sometimes we have someBoolean === false
is to ensure undefined
doesn't satisfy this clause. I feel like making the boolean that would have the default value as false would feel more natural. Since you can just do
{licenseActiveAtSetup === false && ( | |
{!licenseActiveAtSetup && ( |
That being said, I guess from the name, this value should be false
unless users activate their license, so I don't see the reason why we need to use xxx === false
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 agree that's more readable, I think it may still make sense to set the default to undefined/null to make it explicit that the instance was setup after we introduced this, meaning that those flag have no value at all
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.
to elaborate on what I meant by the default value as false. That covers the case for null
and undefined
too. I should have said falsy value by default.
It would feel more natural if you pass undefined
, null
, or false
and gets the same result. Because It gets awkward sometimes if you pass undefined
and false
and get different results.
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 I see, yeah that makes sense, I'll make sure not to render this when the any of the flags are undefined/null as it means they did the setup before this was introduced
…eTabContent.tsx Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
* wip ui for the full embedding homepage * adds missing link + fix keys * remove done TODO * Update frontend/src/metabase/home/components/EmbedHomepage/InteractiveTabContent.tsx Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> * destructure props in the function arguments * rename customerFacingAnalyticsDocsUrl to analyticsDocsUrl --------- Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
* wip ui for the full embedding homepage * adds missing link + fix keys * remove done TODO * Update frontend/src/metabase/home/components/EmbedHomepage/InteractiveTabContent.tsx Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> * destructure props in the function arguments * rename customerFacingAnalyticsDocsUrl to analyticsDocsUrl --------- Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
* create ui for the full embedding homepage, without any logic (#40251) * wip ui for the full embedding homepage * adds missing link + fix keys * remove done TODO * Update frontend/src/metabase/home/components/EmbedHomepage/InteractiveTabContent.tsx Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> * destructure props in the function arguments * rename customerFacingAnalyticsDocsUrl to analyticsDocsUrl --------- Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> * add new settings for embedding homepage (#40455) * remove old minimal version * adds new embedding homepage settings and sets them at the end of the setup * comment e2e test * add tests for embedding homepage flags * more tests * remove unit tests related to old minimal version * fixes flags descriptions * :keyword for embedding-homepage Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> * replace reloadSettings and refreshSettingsList with initializeSettings * `value => value === true` -> `Boolean` * toMatchObject -> toEqual for more strict tests * remove useless undefined check for settings, the component is conditionally rendered based on a setting so it means they're loaded anyway * fix: use :hidden as we changed the type to :keyword * specifically check for the `embedding` feature in the tokenFeatures object instead of checking if any feature is active * remove double \n Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com> --------- Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com> * connect settings to the embed homepage and show it (#40528) * fix nested a warnings in browser console * connect settings to the embed homepage and show it * fix stories * remove localStorage.clear() as we're not using it in the logic anymore * dismiss without feedback for the embedding homepage (#40587) * feat: add dismiss functionality to the embed homepage * update setup e2e to check for the dismissal of embedding homepage * use List from metabase/ui (#40638) * set embedding-secret-key when embedding is enabled (#40813) * set embedding-secret-key when embedding is enabled * use "named" setters and getters as suggested by Noah * Fix tests for ms1 after updating on master (#41069) --------- Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Part of [Epic] Initial homepage experience for embedding admins
Description
This only adds the "dumb" UI, all the logic and tests will come in separate PRs
Note that I'm currently importing
List
frommantine
, I'll open a PR to re-export it frommetabase/ui
(see slack) and to also fix the numbers not showing up without the inline style.How to verify
yarn storybook