Fix lint errors

This commit is contained in:
Tuan Dang
2023-07-10 15:06:00 +07:00
parent e91e7f96c2
commit 9e5b9cbdb5
6 changed files with 9 additions and 49 deletions
@@ -1,12 +1,11 @@
import Link from "next/link"; import { useOrganization, useSubscription } from "@app/context";
import { useSubscription } from "@app/context";
import { Button } from "@app/components/v2";
import { Modal, ModalClose, ModalContent } from "../Modal";
import { useOrganization } from "@app/context";
import { import {
useGetOrgTrialUrl useGetOrgTrialUrl
} from "@app/hooks/api"; } from "@app/hooks/api";
import { Button } from "../Button";
import { Modal, ModalContent } from "../Modal";
type Props = { type Props = {
isOpen?: boolean; isOpen?: boolean;
onOpenChange?: (isOpen: boolean) => void; onOpenChange?: (isOpen: boolean) => void;
+1 -1
View File
@@ -12,7 +12,7 @@ export {
useGetOrgPlanTable, useGetOrgPlanTable,
useGetOrgPmtMethods, useGetOrgPmtMethods,
useGetOrgTaxIds, useGetOrgTaxIds,
useRenameOrg,
useGetOrgTrialUrl, useGetOrgTrialUrl,
useRenameOrg,
useUpdateOrgBillingDetails useUpdateOrgBillingDetails
} from "./queries"; } from "./queries";
@@ -11,7 +11,6 @@ import {
PmtMethod, PmtMethod,
ProductsTable, ProductsTable,
RenameOrgDTO, RenameOrgDTO,
GetOrgTrialUrlDTO,
TaxID TaxID
} from "./types"; } from "./types";
@@ -10,11 +10,6 @@ export type RenameOrgDTO = {
newOrgName: string; newOrgName: string;
}; };
export type GetOrgTrialUrlDTO = {
orgId: string;
success_url: string;
}
export type BillingDetails = { export type BillingDetails = {
name: string; name: string;
email: string; email: string;
@@ -3,7 +3,6 @@
import { Fragment, useMemo } from "react"; import { Fragment, useMemo } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { faGithub, faSlack } from "@fortawesome/free-brands-svg-icons"; import { faGithub, faSlack } from "@fortawesome/free-brands-svg-icons";
import { faCircleQuestion } from "@fortawesome/free-regular-svg-icons"; import { faCircleQuestion } from "@fortawesome/free-regular-svg-icons";
@@ -23,9 +22,8 @@ import {TFunction} from "i18next";
import guidGenerator from "@app/components/utilities/randomId"; import guidGenerator from "@app/components/utilities/randomId";
import { useOrganization, useSubscription,useUser } from "@app/context"; import { useOrganization, useSubscription,useUser } from "@app/context";
import { import {
useLogoutUser, useGetOrgTrialUrl,
useGetOrgTrialUrl useLogoutUser} from "@app/hooks/api";
} from "@app/hooks/api";
const supportOptions = (t: TFunction) => [ const supportOptions = (t: TFunction) => [
[ [
@@ -70,7 +68,7 @@ export const Navbar = () => {
const { subscription } = useSubscription(); const { subscription } = useSubscription();
const { currentOrg, orgs } = useOrganization(); const { currentOrg, orgs } = useOrganization();
const { mutateAsync, isLoading } = useGetOrgTrialUrl(); const { mutateAsync } = useGetOrgTrialUrl();
const { user } = useUser(); const { user } = useUser();
const logout = useLogoutUser(); const logout = useLogoutUser();
@@ -100,37 +98,6 @@ export const Navbar = () => {
} }
}; };
function formatPlanSlug(slug: string) {
return slug
.replace(/(\b[a-z])/g, match => match.toUpperCase())
.replace(/-/g, " ");
}
const calculateRemainingDays = (date: number) => {
const now = new Date();
const endDate = new Date(date * 1000);
const differenceInTime = endDate.getTime() - now.getTime();
const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));
return differenceInDays;
}
const formatDate = (date: number) => {
const endDate = new Date(date * 1000);
const day: number = endDate.getDate();
const month: number = endDate.getMonth() + 1;
const year: number = endDate.getFullYear();
const formattedDate: string = `${day}/${month}/${year}`;
const remainingDays: number = calculateRemainingDays(date);
return {
formattedDate,
remainingDays
};
}
return ( return (
<div className="z-[70] border-b border-mineshaft-500 bg-mineshaft-900 text-white"> <div className="z-[70] border-b border-mineshaft-500 bg-mineshaft-900 text-white">
<div className="flex w-full justify-between px-4"> <div className="flex w-full justify-between px-4">
@@ -11,7 +11,7 @@ import { ManagePlansModal } from "./ManagePlansModal";
export const PreviewSection = () => { export const PreviewSection = () => {
const { currentOrg } = useOrganization(); const { currentOrg } = useOrganization();
const { subscription, isLoading: isSubscriptionLoading } = useSubscription(); const { subscription } = useSubscription();
const { data, isLoading } = useGetOrgPlanBillingInfo(currentOrg?._id ?? ""); const { data, isLoading } = useGetOrgPlanBillingInfo(currentOrg?._id ?? "");
const getOrgTrialUrl = useGetOrgTrialUrl(); const getOrgTrialUrl = useGetOrgTrialUrl();
const createCustomerPortalSession = useCreateCustomerPortalSession(); const createCustomerPortalSession = useCreateCustomerPortalSession();