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(dashboard): free trial card #6612

Merged
merged 6 commits into from
Oct 4, 2024
Merged

Conversation

LetItRock
Copy link
Contributor

What changed? Why was the change needed?

The Free Trial Card component that is shown at the bottom of the side navigation.

Screenshots

Screen.Recording.2024-10-03.at.23.46.09.mov
Screen.Recording.2024-10-03.at.23.51.45.mov

Copy link

linear bot commented Oct 3, 2024

@@ -23,16 +23,19 @@
"@clerk/clerk-react": "^5.2.5",
"@hookform/resolvers": "^2.9.1",
"@novu/react": "^2.3.0",
"@novu/shared": "^2.1.0",
"@novu/shared": "workspace:*",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

shared package we would like to take from the workspace

@@ -0,0 +1,46 @@
export const LogoCircle = (props: React.ComponentPropsWithoutRef<'svg'>) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

novu logo circle - the svg was compressed

Comment on lines +19 to +20
light:
'bg-destructive/10 hover:bg-background hover:border hover:border-destructive text-destructive focus-visible:ring-destructive/10 focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:bg-background focus-visible:border focus-visible:border-destructive',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the light variant of the button

Comment on lines +24 to +25
const percentage = (value ?? 100) / (max ?? 100);
const translateX = (percentage - 1) * 100;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

calculations of the translateX for the progress based on value and max

variants: {
variant: {
default: 'bg-primary text-primary-foreground',
light: 'border border-stroke/20 bg-background shadow-xs',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tooltip implemented only a light version with the LG size, not sure if I have to invest time in all variants?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's fine for now!

<LogoCircle className={`h-3 w-3 ${transition} group-hover:h-4 group-hover:w-4`} />
</div>
<span className="text-foreground text-sm">{pluralizedDays} left on trial</span>
<TooltipProvider>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this provider need to be always defined like that? weird

Comment on lines 19 to 21
if (isLoading || !trial.isActive || hasPaymentMethod) {
return null;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ChmaraX, is this logic correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove the hasPaymentMethod - currently its there to support the legacy billing, but when we release new billing (which will next week) we don't use hasPaymentMethod as a check for trial anymore.

FYI: in new billing, you are able to only buy right away, so there is no state where you would be in trial and have payment method saved

import { get } from './api.client';

export async function getBillingSubscription() {
const { data } = await get<{ data: GetSubscriptionDto }>('/billing/subscription');
Copy link
Contributor

Choose a reason for hiding this comment

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

Note for a separate PR, we need to add a global error handler for all the data fetching.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

variants: {
variant: {
default: 'bg-primary text-primary-foreground',
light: 'border border-stroke/20 bg-background shadow-xs',
Copy link
Contributor

Choose a reason for hiding this comment

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

It's fine for now!

apps/dashboard/src/hooks/use-billing-subscription.ts Outdated Show resolved Hide resolved
}
);

const daysLeft = useMemo(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit-picky, we can add this to the API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, but that will require changes in three apps: api, web, dashboard

Copy link
Contributor

Choose a reason for hiding this comment

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

We can add only one new field for the Dashboard.

Base automatically changed from nv-4346-dashboard-side-nav to next October 4, 2024 13:55
Copy link

pkg-pr-new bot commented Oct 4, 2024

Open in Stackblitz

novu

pnpm add https://pkg.pr.new/novuhq/novu@6612

@novu/client

pnpm add https://pkg.pr.new/novuhq/novu/@novu/client@6612

@novu/framework

pnpm add https://pkg.pr.new/novuhq/novu/@novu/framework@6612

@novu/headless

pnpm add https://pkg.pr.new/novuhq/novu/@novu/headless@6612

@novu/nest

pnpm add https://pkg.pr.new/novuhq/novu/@novu/nest@6612

@novu/node

pnpm add https://pkg.pr.new/novuhq/novu/@novu/node@6612

@novu/js

pnpm add https://pkg.pr.new/novuhq/novu/@novu/js@6612

@novu/notification-center

pnpm add https://pkg.pr.new/novuhq/novu/@novu/notification-center@6612

@novu/providers

pnpm add https://pkg.pr.new/novuhq/novu/@novu/providers@6612

@novu/react

pnpm add https://pkg.pr.new/novuhq/novu/@novu/react@6612

@novu/shared

pnpm add https://pkg.pr.new/novuhq/novu/@novu/shared@6612

@novu/stateless

pnpm add https://pkg.pr.new/novuhq/novu/@novu/stateless@6612

commit: db593ff

Copy link

netlify bot commented Oct 4, 2024

Deploy Preview for novu-stg-vite-dashboard-poc ready!

Name Link
🔨 Latest commit db593ff
🔍 Latest deploy log https://app.netlify.com/sites/novu-stg-vite-dashboard-poc/deploys/6700047216c2ac000809b22d
😎 Deploy Preview https://deploy-preview-6612--novu-stg-vite-dashboard-poc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@LetItRock LetItRock merged commit 44c37b1 into next Oct 4, 2024
41 checks passed
@LetItRock LetItRock deleted the nv-4347-dashboard-free-trial-card branch October 4, 2024 19:27
tatarco pushed a commit that referenced this pull request Oct 7, 2024
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.

3 participants