-
Notifications
You must be signed in to change notification settings - Fork 228
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
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> | ||
)} | ||
</> |
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.
Removing experiment
{!hideShortcuts && | ||
(showGetStarted ? ( | ||
<ShortcutGetStarted | ||
onTopSitesClick={toggleShowTopSites} | ||
onCustomLinksClick={onOptionsOpen} | ||
/> | ||
) : ( | ||
<ShortcutLinksList | ||
{...{ | ||
onLinkClick, | ||
onMenuClick, | ||
onOptionsOpen, | ||
shortcutLinks, | ||
shouldUseListFeedLayout, | ||
showTopSites, | ||
toggleShowTopSites, | ||
hasCheckedPermission, | ||
}} | ||
/> | ||
))} |
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.
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
import React, { | ||
MouseEventHandler, | ||
PropsWithChildren, | ||
ReactElement, | ||
} from '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.
Removed this component and created new ones for clarity:
- list
- item
- get started
const { isOldUser, showToggleShortcuts } = useShortcutsUser(); | ||
|
||
const hasNoShortcuts = !shortcutLinks?.length && showTopSites; | ||
const showGetStarted = !isOldUser && hasNoShortcuts; |
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.
New logic, check if is old user then hide get started if it is.
useEffect(() => { | ||
if (gb && experimentation?.features) { | ||
const currentFeats = gb.getFeatures(); | ||
const currentFeats = gb.getFeatures?.(); | ||
// Do not update when the features are already set | ||
if (!currentFeats || !Object.keys(currentFeats).length) { | ||
gb.setFeatures(experimentation.features); | ||
gb.setFeatures?.(experimentation.features); | ||
setReady(true); | ||
} |
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.
Added optional chaining because this made Storybook crash, should not impact prod but saved me a lot of refactoring in sb.
export const useShortcutsUser = () => { | ||
const { user, isAuthReady } = useAuthContext(); | ||
const { checkHasCompleted, isActionsFetched } = useActions(); | ||
const isExtension = checkIsExtension(); | ||
const { showTopSites } = useSettingsContext(); | ||
|
||
const isOldUser = | ||
isAuthReady && | ||
user?.createdAt && | ||
new Date(user.createdAt) < DATE_TO_SHOW_SHORTCUTS; | ||
const hasCompletedFirstSession = | ||
isActionsFetched && checkHasCompleted(ActionType.FirstShortcutsSession); | ||
const isOldUserWithNoShortcuts = isOldUser && !hasCompletedFirstSession; | ||
|
||
return { | ||
isOldUser, | ||
isOldUserWithNoShortcuts, | ||
hasCompletedFirstSession, | ||
showToggleShortcuts: | ||
isExtension && (!showTopSites || isOldUserWithNoShortcuts), | ||
hideInitialBanner: isOldUserWithNoShortcuts, | ||
}; | ||
}; |
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 a common hook between shared
and extension
, used for not duplicate checks.
@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? |
I'm referring to this button indeed, just asking if they currently see it or if we introduce it as part of this pr? |
erge branch 'chore-shortcuts-ui' of https://github.com/dailydotdev/apps into chore-shortcuts-ui
@idoshamun I've checked with a non-updated extension and seems nothing have changed for new users ✔️ |
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 didn't review the code, but explanation and business logic makes sense to me. Please wait for an actual review
Original PR from @nensidosari , now mantained by @ilasw
Changes
Summary
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:
Screens
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