-
Notifications
You must be signed in to change notification settings - Fork 311
feat: added user feedback on why liking the dashboard is not clickable #2183
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import { lazy, Suspense, useState } from 'react' | ||
| import { useRouter } from 'next/router' | ||
| import toast from 'react-hot-toast' | ||
| import { Icon } from '~/components/Icon' | ||
| import { BasicLink } from '~/components/Link' | ||
| import { LoadingSpinner } from '~/components/Loaders' | ||
|
|
@@ -210,7 +211,7 @@ function ProDashboardContent() { | |
| <Tooltip | ||
| content="Views" | ||
| render={<p />} | ||
| className="flex items-center gap-1 rounded-md border border-(--cards-border) px-1.5 py-1 text-xs text-(--text-disabled)" | ||
| className="flex items-center gap-1 rounded-md border border-(--cards-border) px-1.5 py-1 text-xs" | ||
| > | ||
| <Icon name="eye" height={14} width={14} /> | ||
| <span>{currentDashboard?.viewCount || 0}</span> | ||
|
|
@@ -417,7 +418,18 @@ const LikeDashboardButton = ({ | |
| return ( | ||
| <Tooltip | ||
| content={currentDashboard?.liked ? 'Unlike dashboard' : 'Like dashboard'} | ||
| render={<button onClick={() => toggleLike()} disabled={isLiking || !isAuthenticated} />} | ||
| render={ | ||
| <button | ||
| onClick={() => { | ||
| if (isAuthenticated) { | ||
| toggleLike() | ||
| } else { | ||
| toast.error('Please sign in to like a dashboard') | ||
| } | ||
| }} | ||
| disabled={isLiking} | ||
| /> | ||
| } | ||
| className={`hover:not-disabled:pro-btn-blue focus-visible:not-disabled:pro-btn-blue flex items-center gap-1 rounded-md border border-(--form-control-border) px-1.5 py-1 text-xs hover:border-transparent focus-visible:border-transparent`} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. user will also need to subscribe to like a dashboard, i don't think toast is helpful
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we redirect users to the sign in page or show a better toast message? rn when someone clicks the like button, it’s disabled if they are not signed it, I felt it’s better to give feedback on what’s missing before they can like it. |
||
| > | ||
| {isLiking ? ( | ||
|
|
||
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.
why remove this color ? we use this text color to differentiate it from like button as this isn't clickable
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 reason I removed it is to make it consistent with the other two buttons.