Skip to content
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

chore: cleanup shortcuts experiment #3742

Merged
merged 32 commits into from
Nov 25, 2024
Merged

chore: cleanup shortcuts experiment #3742

merged 32 commits into from
Nov 25, 2024

Conversation

nensidosari
Copy link
Contributor

@nensidosari nensidosari commented Oct 31, 2024

Original PR from @nensidosari , now mantained by @ilasw

Changes

Summary

  • Cleanup experiment;
  • Refactor Shortcuts (split in multiple files);
  • Add isOldUser case and hide GetStarted component for them;
  • Updated tests
  • Small fixes

Description

Initially this task was about removing the experiment but due to the bad performance of the Get started banner for already existing users (registered before experiment) we added a rule that remove this step for them.

Basically this should be every possible option:

  • Old user (registered before experiment)
    • have never used/disabled shortcuts -> see the "add shortcuts" button
    • have disabled shortcuts -> see the "add shortcuts" button
    • have enabled shortcuts
      • if there are custom links -> show them
      • if empty -> show placeholder
  • New user
    • have never used/disabled shortcuts -> see the get started banner
    • have disabled shortcuts -> see the "add shortcuts" button
    • have enabled shortcuts
      • if there are custom links -> show them
      • if empty -> show placeholder

Screens

No action made Disabled shortcuts Shortcut empty Shortcut with links
New user image image image image
Old user image image image image

Old user check is IF registrationDate < 2024-07-16 date since experiment was launched.

Events

Did you introduce any new tracking events?

Experiment

Did you introduce any new experiments?

Manual Testing

Caution

Please make sure existing components are not breaking/affected by this PR

Preview domain

https://chore-shortcuts-ui.preview.app.daily.dev

Copy link

vercel bot commented Oct 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
daily-webapp ✅ Ready (Inspect) Visit Preview Nov 25, 2024 1:49pm
1 Skipped Deployment
Name Status Preview Updated (UTC)
storybook ⬜️ Ignored (Inspect) Nov 25, 2024 1:49pm

@ilasw ilasw changed the title Chore shortcuts UI chore: cleanup shortcuts experiment Nov 20, 2024
Comment on lines -40 to -69
type ShortcutLinksControlProps = {
className?: string;
onLinkClick: () => void;
onOptionsOpen: () => void;
shortcutLinks: string[];
};

function ShortcutLinksUIControl(props: ShortcutLinksControlProps) {
const { shortcutLinks, onLinkClick, onOptionsOpen, className } = props;
return (
<>
{shortcutLinks?.length ? (
<CustomLinks
links={shortcutLinks}
className={className}
onOptions={onOptionsOpen}
onLinkClick={onLinkClick}
/>
) : (
<Button
className={className}
variant={ButtonVariant.Tertiary}
icon={<PlusIcon />}
iconPosition={ButtonIconPosition.Right}
onClick={onOptionsOpen}
>
Add shortcuts
</Button>
)}
</>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing experiment

Comment on lines +134 to +153
{!hideShortcuts &&
(showGetStarted ? (
<ShortcutGetStarted
onTopSitesClick={toggleShowTopSites}
onCustomLinksClick={onOptionsOpen}
/>
) : (
<ShortcutLinksList
{...{
onLinkClick,
onMenuClick,
onOptionsOpen,
shortcutLinks,
shouldUseListFeedLayout,
showTopSites,
toggleShowTopSites,
hasCheckedPermission,
}}
/>
))}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hideShortcuts checks if shortcuts are visible

showGetStarted check if !isOldUser && hasNoShortcuts, basically old users will never see the get started banner even if they don't have any shortcuts atm

Comment on lines -1 to -5
import React, {
MouseEventHandler,
PropsWithChildren,
ReactElement,
} from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this component and created new ones for clarity:

  • list
  • item
  • get started

Comment on lines 60 to 63
const { isOldUser, showToggleShortcuts } = useShortcutsUser();

const hasNoShortcuts = !shortcutLinks?.length && showTopSites;
const showGetStarted = !isOldUser && hasNoShortcuts;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New logic, check if is old user then hide get started if it is.

@ilasw
Copy link
Contributor

ilasw commented Nov 21, 2024

@ilasw does new user have the "shortcuts" button as well? or do you introduce it now?

i mean the button they see when they disable the extension

@idoshamun yes if I correctly understand this button is visible inside the description's table (I know the preview is very small...). Are you referring to this button, right?

image image

@idoshamun
Copy link
Member

I'm referring to this button indeed, just asking if they currently see it or if we introduce it as part of this pr?

@ilasw
Copy link
Contributor

ilasw commented Nov 21, 2024

I'm referring to this button indeed, just asking if they currently see it or if we introduce it as part of this pr?

@idoshamun I've checked with a non-updated extension and seems nothing have changed for new users ✔️

Copy link
Member

@idoshamun idoshamun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't review the code, but explanation and business logic makes sense to me. Please wait for an actual review

<ShortcutItemPlaceholder key={url}>
<img
src={url}
alt={url}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure the alt should be the url.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm adding some context to alt but unfortunately we don't have any more infos than url at this point

Comment on lines +57 to +58
completeAction(ActionType.FirstShortcutsSession);
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After completing the action, it seems that we won't be doing anything here. Is that intended?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, completing action turn isOldUserWithNoShortcuts into a standard user and enable the shortcuts ✔️

showGetStarted,
hideShortcuts: showToggleShortcuts,
onSaveChanges,
askTopSitesPermission: async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't remember if this was used in any dependencies, but should we maybe wrap it in a useCallback to make the returned function stable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I've seen most of the functions, are not wrapped, probably good to check whether we should add the wrap.

Copy link
Member

@sshanzel sshanzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work on taking over and the summary of the task itself. I don't have anything blocking, so technically approving but wanted to manually test a prod build first to do some sanity checks.

Copy link
Member

@sshanzel sshanzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually tested and worked really well 🚀

Copy link
Member

@sshanzel sshanzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't have much to add based on the recent changes! :shipit:

Co-authored-by: Lee Hansel Solevilla <[email protected]>
@ilasw ilasw merged commit 32ecc3b into main Nov 25, 2024
10 checks passed
@ilasw ilasw deleted the chore-shortcuts-ui branch November 25, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants