fix: build issues

This commit is contained in:
sriram veeraghanta 2024-03-06 19:52:40 +05:30
parent 66f2492e60
commit f188c9fdc5
30 changed files with 48 additions and 230 deletions

View File

@ -1,10 +1,12 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
// services
import { TOAST_TYPE, setToast } from "@plane/ui";
import { GitHubSignInButton, GoogleSignInButton } from "components/account";
import { useApplication } from "hooks/store";
// ui // ui
import { TOAST_TYPE, setToast } from "@plane/ui";
// components // components
import { GitHubSignInButton, GoogleSignInButton } from "components/account";
// hooks
import { useApplication } from "hooks/store";
// services
import { AuthService } from "services/auth.service";
type Props = { type Props = {
handleSignInRedirection: () => Promise<void>; handleSignInRedirection: () => Promise<void>;
@ -74,7 +76,7 @@ export const OAuthOptions: React.FC<Props> = observer((props) => {
</div> </div>
<div className={`mx-auto mt-7 grid gap-4 overflow-hidden sm:w-96 ${areBothOAuthEnabled ? "grid-cols-2" : ""}`}> <div className={`mx-auto mt-7 grid gap-4 overflow-hidden sm:w-96 ${areBothOAuthEnabled ? "grid-cols-2" : ""}`}>
{envConfig?.google_client_id && ( {envConfig?.google_client_id && (
<div className="h-[42px] flex items-center !overflow-hidden"> <div className="flex h-[42px] items-center !overflow-hidden">
<GoogleSignInButton clientId={envConfig?.google_client_id} handleSignIn={handleGoogleSignIn} type={type} /> <GoogleSignInButton clientId={envConfig?.google_client_id} handleSignIn={handleGoogleSignIn} type={type} />
</div> </div>
)} )}

View File

@ -1,94 +0,0 @@
import { useEffect } from "react";
import { observer } from "mobx-react-lite";
import Link from "next/link";
// hooks
import { Avatar } from "@plane/ui";
import { RecentCollaboratorsEmptyState, WidgetLoader, WidgetProps } from "components/dashboard/widgets";
import { useDashboard, useMember, useUser } from "hooks/store";
// components
// ui
// types
import { TRecentCollaboratorsWidgetResponse } from "@plane/types";
type CollaboratorListItemProps = {
issueCount: number;
userId: string;
workspaceSlug: string;
};
const WIDGET_KEY = "recent_collaborators";
const CollaboratorListItem: React.FC<CollaboratorListItemProps> = observer((props) => {
const { issueCount, userId, workspaceSlug } = props;
// store hooks
const { currentUser } = useUser();
const { getUserDetails } = useMember();
// derived values
const userDetails = getUserDetails(userId);
const isCurrentUser = userId === currentUser?.id;
if (!userDetails) return null;
return (
<Link href={`/${workspaceSlug}/profile/${userId}`} className="group text-center">
<div className="flex justify-center">
<Avatar
src={userDetails.avatar}
name={isCurrentUser ? "You" : userDetails.display_name}
size={69}
className="!text-3xl !font-medium"
showTooltip={false}
/>
</div>
<h6 className="mt-6 text-xs font-semibold group-hover:underline truncate">
{isCurrentUser ? "You" : userDetails?.display_name}
</h6>
<p className="text-sm mt-2">
{issueCount} active issue{issueCount > 1 ? "s" : ""}
</p>
</Link>
);
});
export const RecentCollaboratorsWidget: React.FC<WidgetProps> = observer((props) => {
const { dashboardId, workspaceSlug } = props;
// store hooks
const { fetchWidgetStats, getWidgetStats } = useDashboard();
const widgetStats = getWidgetStats<TRecentCollaboratorsWidgetResponse[]>(workspaceSlug, dashboardId, WIDGET_KEY);
useEffect(() => {
fetchWidgetStats(workspaceSlug, dashboardId, {
widget_key: WIDGET_KEY,
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
if (!widgetStats) return <WidgetLoader widgetKey={WIDGET_KEY} />;
return (
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full hover:shadow-custom-shadow-4xl duration-300">
<div className="px-7 pt-6">
<h4 className="text-lg font-semibold text-custom-text-300">Most active members</h4>
<p className="mt-2 text-xs font-medium text-custom-text-300">
Top eight active members in your project by last activity
</p>
</div>
{widgetStats.length > 1 ? (
<div className="mt-7 mb-6 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 xl:grid-cols-8 gap-2 gap-y-8">
{widgetStats.map((user) => (
<CollaboratorListItem
key={user.user_id}
issueCount={user.active_issue_count}
userId={user.user_id}
workspaceSlug={workspaceSlug}
/>
))}
</div>
) : (
<div className="h-full grid place-items-center">
<RecentCollaboratorsEmptyState />
</div>
)}
</div>
);
});

View File

@ -4,6 +4,7 @@ import { Eye, EyeOff } from "lucide-react";
// ui // ui
import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui";
// types // types
import { IFormattedInstanceConfiguration } from "@plane/types";
// hooks // hooks
import { useApplication } from "hooks/store"; import { useApplication } from "hooks/store";

View File

@ -4,6 +4,7 @@ import { Controller, useForm } from "react-hook-form";
import { Eye, EyeOff } from "lucide-react"; import { Eye, EyeOff } from "lucide-react";
import { Button, Input, ToggleSwitch, TOAST_TYPE, setToast } from "@plane/ui"; import { Button, Input, ToggleSwitch, TOAST_TYPE, setToast } from "@plane/ui";
// types // types
import { IFormattedInstanceConfiguration } from "@plane/types";
// hooks // hooks
import { useApplication } from "hooks/store"; import { useApplication } from "hooks/store";

View File

@ -3,6 +3,7 @@ import { Controller, useForm } from "react-hook-form";
// ui // ui
import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui";
// types // types
import { IInstance, IInstanceAdmin } from "@plane/types";
// hooks // hooks
import { useApplication } from "hooks/store"; import { useApplication } from "hooks/store";

View File

@ -4,6 +4,7 @@ import { Copy, Eye, EyeOff } from "lucide-react";
// ui // ui
import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui";
// types // types
import { IFormattedInstanceConfiguration } from "@plane/types";
// hooks // hooks
import { useApplication } from "hooks/store"; import { useApplication } from "hooks/store";

View File

@ -4,6 +4,7 @@ import { Copy } from "lucide-react";
// ui // ui
import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui";
// types // types
import { IFormattedInstanceConfiguration } from "@plane/types";
// hooks // hooks
import { useApplication } from "hooks/store"; import { useApplication } from "hooks/store";

View File

@ -4,6 +4,7 @@ import { Eye, EyeOff } from "lucide-react";
// ui // ui
import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui";
// types // types
import { IFormattedInstanceConfiguration } from "@plane/types";
// hooks // hooks
import { useApplication } from "hooks/store"; import { useApplication } from "hooks/store";

View File

@ -5,6 +5,8 @@ import { Eye, EyeOff, XCircle } from "lucide-react";
import { Input, Button, TOAST_TYPE, setToast } from "@plane/ui"; import { Input, Button, TOAST_TYPE, setToast } from "@plane/ui";
// helpers // helpers
import { checkEmailValidity } from "helpers/string.helper"; import { checkEmailValidity } from "helpers/string.helper";
// hooks
import { useUser } from "hooks/store";
// services // services
import { AuthService } from "services/auth.service"; import { AuthService } from "services/auth.service";
const authService = new AuthService(); const authService = new AuthService();

View File

@ -30,6 +30,7 @@ import { IntegrationService, GithubIntegrationService } from "services/integrati
// types // types
import { IGithubRepoCollaborator, IGithubServiceImportFormData } from "@plane/types"; import { IGithubRepoCollaborator, IGithubServiceImportFormData } from "@plane/types";
// fetch-keys // fetch-keys
import { APP_INTEGRATIONS, IMPORTER_SERVICES_LIST, WORKSPACE_INTEGRATIONS } from "constants/fetch-keys";
export type TIntegrationSteps = "import-configure" | "import-data" | "repo-details" | "import-users" | "import-confirm"; export type TIntegrationSteps = "import-configure" | "import-data" | "repo-details" | "import-users" | "import-confirm";
export interface IIntegrationData { export interface IIntegrationData {

View File

@ -5,6 +5,8 @@ import { AlertTriangle } from "lucide-react";
import { Button, TOAST_TYPE, setToast } from "@plane/ui"; import { Button, TOAST_TYPE, setToast } from "@plane/ui";
// types // types
import { TIssue } from "@plane/types"; import { TIssue } from "@plane/types";
// hooks
import { useIssues, useProject } from "hooks/store";
type Props = { type Props = {
isOpen: boolean; isOpen: boolean;

View File

@ -15,6 +15,8 @@ import { TGroupedIssues, TIssue } from "@plane/types";
import { IQuickActionProps } from "../list/list-view-types"; import { IQuickActionProps } from "../list/list-view-types";
import { EIssueActions } from "../types"; import { EIssueActions } from "../types";
import { handleDragDrop } from "./utils"; import { handleDragDrop } from "./utils";
import { useIssues, useUser } from "hooks/store";
import { EUserProjectRoles } from "constants/project";
interface IBaseCalendarRoot { interface IBaseCalendarRoot {
issueStore: IProjectIssues | IModuleIssues | ICycleIssues | IProjectViewIssues; issueStore: IProjectIssues | IModuleIssues | ICycleIssues | IProjectViewIssues;

View File

@ -15,6 +15,7 @@ import useOutsideClickDetector from "hooks/use-outside-click-detector";
// ui // ui
// types // types
import { IProject, TIssue } from "@plane/types"; import { IProject, TIssue } from "@plane/types";
import { ISSUE_CREATED } from "constants/event-tracker";
// constants // constants
interface IInputProps { interface IInputProps {
@ -162,7 +163,7 @@ export const GanttQuickAddIssueForm: React.FC<IGanttQuickAddIssueForm> = observe
) : ( ) : (
<button <button
type="button" type="button"
className="sticky bottom-0 z-[1] flex w-full cursor-pointer items-center gap-2 p-3 py-3 text-custom-primary-100 bg-custom-background-100 border-custom-border-200 border-t-[1px]" className="sticky bottom-0 z-[1] flex w-full cursor-pointer items-center gap-2 border-t-[1px] border-custom-border-200 bg-custom-background-100 p-3 py-3 text-custom-primary-100"
onClick={() => setIsOpen(true)} onClick={() => setIsOpen(true)}
> >
<PlusIcon className="h-3.5 w-3.5 stroke-2" /> <PlusIcon className="h-3.5 w-3.5 stroke-2" />

View File

@ -8,7 +8,7 @@ import { DeleteIssueModal } from "components/issues";
import { ISSUE_DELETED } from "constants/event-tracker"; import { ISSUE_DELETED } from "constants/event-tracker";
import { EIssueFilterType, TCreateModalStoreTypes } from "constants/issue"; import { EIssueFilterType, TCreateModalStoreTypes } from "constants/issue";
import { EUserProjectRoles } from "constants/project"; import { EUserProjectRoles } from "constants/project";
import { useEventTracker, useUser } from "hooks/store"; import { useEventTracker, useIssues, useUser } from "hooks/store";
// ui // ui
// types // types
import { ICycleIssues, ICycleIssuesFilter } from "store/issue/cycle"; import { ICycleIssues, ICycleIssuesFilter } from "store/issue/cycle";

View File

@ -77,7 +77,7 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
}); });
}; };
const handleUpdateModule = async (payload: Partial<IModule>, dirtyFields: unknown) => { const handleUpdateModule = async (payload: Partial<IModule>, dirtyFields: any) => {
if (!workspaceSlug || !projectId || !data) return; if (!workspaceSlug || !projectId || !data) return;
const selectedProjectId = payload.project_id ?? projectId.toString(); const selectedProjectId = payload.project_id ?? projectId.toString();

View File

@ -368,8 +368,8 @@ export const InviteMembers: React.FC<Props> = (props) => {
> >
<p className="text-base font-semibold text-onboarding-text-400">Members</p> <p className="text-base font-semibold text-onboarding-text-400">Members</p>
{Array.from({ length: 4 }).map((i) => ( {Array.from({ length: 4 }).map((i, index) => (
<div key={i} className="mt-6 flex items-center gap-2"> <div key={index} className="mt-6 flex items-center gap-2">
<div className="flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full"> <div className="flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full">
<Image src={resolvedTheme === "dark" ? userDark : userLight} alt="user" className="object-cover" /> <Image src={resolvedTheme === "dark" ? userDark : userLight} alt="user" className="object-cover" />
</div> </div>

View File

@ -240,7 +240,7 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
<ProjectLogo logo={value} className="text-xl" /> <ProjectLogo logo={value} className="text-xl" />
</span> </span>
} }
onChange={(val) => { onChange={(val: any) => {
let logoValue = {}; let logoValue = {};
if (val.type === "emoji") if (val.type === "emoji")

View File

@ -9,6 +9,7 @@ import { useEventTracker, useProject } from "hooks/store";
// ui // ui
// types // types
import type { IProject } from "@plane/types"; import type { IProject } from "@plane/types";
import { PROJECT_DELETED } from "constants/event-tracker";
// constants // constants
type DeleteProjectModal = { type DeleteProjectModal = {

View File

@ -1,6 +1,7 @@
import React from "react"; import React from "react";
import Image from "next/image"; import Image from "next/image";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import useSWR, { mutate } from "swr";
// ui // ui
import { TOAST_TYPE, setToast } from "@plane/ui"; import { TOAST_TYPE, setToast } from "@plane/ui";
// components // components
@ -12,6 +13,8 @@ import GithubLogo from "public/logos/github-square.png";
import SlackLogo from "public/services/slack.png"; import SlackLogo from "public/services/slack.png";
// types // types
import { IWorkspaceIntegration } from "@plane/types"; import { IWorkspaceIntegration } from "@plane/types";
// services
import { ProjectService } from "services/project";
type Props = { type Props = {
integration: IWorkspaceIntegration; integration: IWorkspaceIntegration;

View File

@ -9,6 +9,9 @@ import { ChevronDown, Plus, X } from "lucide-react";
import { Avatar, Button, CustomSelect, CustomSearchSelect, TOAST_TYPE, setToast } from "@plane/ui"; import { Avatar, Button, CustomSelect, CustomSearchSelect, TOAST_TYPE, setToast } from "@plane/ui";
// helpers // helpers
import { useEventTracker, useMember, useUser } from "hooks/store"; import { useEventTracker, useMember, useUser } from "hooks/store";
import { EUserProjectRoles } from "constants/project";
import { PROJECT_MEMBER_ADDED } from "constants/event-tracker";
import { ROLE } from "constants/workspace";
// constants // constants
type Props = { type Props = {

View File

@ -1,61 +0,0 @@
import React from "react";
// hooks
import { AlertTriangle, CheckCircle, Info, X, XCircle } from "lucide-react";
import useToast from "hooks/use-toast";
// icons
const ToastAlerts = () => {
const { alerts, removeAlert } = useToast();
if (!alerts) return null;
return (
<div className="pointer-events-none fixed right-5 top-5 z-50 h-full w-80 space-y-5 overflow-hidden">
{alerts.map((alert) => (
<div className="relative overflow-hidden rounded-md text-white" key={alert.id}>
<div className="absolute right-1 top-1">
<button
type="button"
className="pointer-events-auto inline-flex rounded-md p-1.5 focus:outline-none focus:ring-2 focus:ring-offset-2"
onClick={() => removeAlert(alert.id)}
>
<span className="sr-only">Dismiss</span>
<X className="h-5 w-5" aria-hidden="true" />
</button>
</div>
<div
className={`px-2 py-4 ${
alert.type === "success"
? "bg-[#06d6a0]"
: alert.type === "error"
? "bg-[#ef476f]"
: alert.type === "warning"
? "bg-[#e98601]"
: "bg-[#1B9aaa]"
}`}
>
<div className="flex items-center gap-x-3">
<div className="flex-shrink-0">
{alert.type === "success" ? (
<CheckCircle className="h-8 w-8" aria-hidden="true" />
) : alert.type === "error" ? (
<XCircle className="h-8 w-8" />
) : alert.type === "warning" ? (
<AlertTriangle className="h-8 w-8" aria-hidden="true" />
) : (
<Info className="h-8 w-8" />
)}
</div>
<div>
<p className="font-semibold">{alert.title}</p>
{alert.message && <p className="mt-1 text-xs">{alert.message}</p>}
</div>
</div>
</div>
</div>
))}
</div>
);
};
export default ToastAlerts;

View File

@ -1,48 +0,0 @@
// nivo
import { ResponsiveMarimekko, SvgProps } from "@nivo/marimekko";
// helpers
import { CHARTS_THEME, DEFAULT_MARGIN } from "constants/graph";
import { generateYAxisTickValues } from "helpers/graph.helper";
// types
import { TGraph } from "./types";
// constants
type Props = {
id: string;
value: string;
customYAxisTickValues?: number[];
};
export const MarimekkoGraph: React.FC<Props & TGraph & Omit<SvgProps<any>, "height" | "width">> = ({
id,
value,
customYAxisTickValues,
height = "400px",
width = "100%",
margin,
theme,
...rest
}) => (
<div style={{ height, width }}>
<ResponsiveMarimekko
id={id}
value={value}
margin={{ ...DEFAULT_MARGIN, ...(margin ?? {}) }}
innerPadding={rest.innerPadding ?? 4}
axisLeft={{
tickSize: 0,
tickPadding: 10,
tickValues: customYAxisTickValues ? generateYAxisTickValues(customYAxisTickValues) : undefined,
}}
axisBottom={{
tickSize: 0,
tickPadding: 10,
tickRotation: rest.data.length > 7 ? -45 : 0,
}}
labelTextColor={{ from: "color", modifiers: [["darker", 1.6]] }}
theme={{ ...CHARTS_THEME, ...(theme ?? {}) }}
animate
{...rest}
/>
</div>
);

View File

@ -71,7 +71,7 @@ export const MultiLevelDropdown: React.FC<MultiLevelDropdownProps> = ({
<div className="relative p-1" key={option.id}> <div className="relative p-1" key={option.id}>
<Menu.Item <Menu.Item
as="button" as="button"
onClick={(e: unknown) => { onClick={(e: any) => {
if (option.hasChildren) { if (option.hasChildren) {
e?.stopPropagation(); e?.stopPropagation();
e?.preventDefault(); e?.preventDefault();
@ -108,12 +108,12 @@ export const MultiLevelDropdown: React.FC<MultiLevelDropdownProps> = ({
height === "sm" height === "sm"
? "max-h-28" ? "max-h-28"
: height === "md" : height === "md"
? "max-h-44" ? "max-h-44"
: height === "rg" : height === "rg"
? "max-h-56" ? "max-h-56"
: height === "lg" : height === "lg"
? "max-h-80" ? "max-h-80"
: "" : ""
}`} }`}
> >
{option.children ? ( {option.children ? (

View File

@ -12,6 +12,7 @@ import { useEventTracker, useWorkspace } from "hooks/store";
// ui // ui
// types // types
import { IWorkspace } from "@plane/types"; import { IWorkspace } from "@plane/types";
import { WorkspaceService } from "services/workspace.service";
type Props = { type Props = {
onSubmit?: (res: IWorkspace) => Promise<void>; onSubmit?: (res: IWorkspace) => Promise<void>;

View File

@ -27,7 +27,7 @@ export const WorkspaceSidebarQuickAction = observer(() => {
membership: { currentWorkspaceRole }, membership: { currentWorkspaceRole },
} = useUser(); } = useUser();
const { storedValue } = useLocalStorage<Record<string, Partial<TIssue>>>("draftedIssue", {}); const { storedValue, setValue } = useLocalStorage<Record<string, Partial<TIssue>>>("draftedIssue", {});
//useState control for displaying draft issue button instead of group hover //useState control for displaying draft issue button instead of group hover
const [isDraftButtonOpen, setIsDraftButtonOpen] = useState(false); const [isDraftButtonOpen, setIsDraftButtonOpen] = useState(false);

View File

@ -11,7 +11,7 @@ import OverdueIssuesLight from "public/empty-state/dashboard/light/overdue-issue
import UpcomingIssuesLight from "public/empty-state/dashboard/light/upcoming-issues.svg"; import UpcomingIssuesLight from "public/empty-state/dashboard/light/upcoming-issues.svg";
// types // types
import { TIssuesListTypes, TStateGroups } from "@plane/types"; import { TIssuesListTypes, TStateGroups } from "@plane/types";
import { Props } from "components/icons/types";
// constants // constants
import { EUserWorkspaceRoles } from "./workspace"; import { EUserWorkspaceRoles } from "./workspace";
// icons // icons

View File

@ -11,9 +11,7 @@ import { useApplication, useUser, useWorkspace } from "hooks/store";
import { Tooltip, TOAST_TYPE, setToast } from "@plane/ui"; import { Tooltip, TOAST_TYPE, setToast } from "@plane/ui";
// constants // constants
import { PROFILE_ACTION_LINKS } from "constants/profile"; import { PROFILE_ACTION_LINKS } from "constants/profile";
import { useApplication, useUser, useWorkspace } from "hooks/store";
import useOutsideClickDetector from "hooks/use-outside-click-detector"; import useOutsideClickDetector from "hooks/use-outside-click-detector";
import useToast from "hooks/use-toast";
const WORKSPACE_ACTION_LINKS = [ const WORKSPACE_ACTION_LINKS = [
{ {

View File

@ -1,10 +1,9 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
// hooks
import { ProfileNavbar, ProfileSidebar } from "components/profile";
import { useUser } from "hooks/store";
// components // components
import { ProfileNavbar, ProfileSidebar } from "components/profile"; import { ProfileNavbar, ProfileSidebar } from "components/profile";
// hooks
import { useUser } from "hooks/store";
// constants // constants
import { EUserWorkspaceRoles } from "constants/workspace"; import { EUserWorkspaceRoles } from "constants/workspace";

View File

@ -49,7 +49,7 @@ const ProfileOverviewPage: NextPageWithLayout = () => {
<ProfileStats userProfile={userProfile} /> <ProfileStats userProfile={userProfile} />
<ProfileWorkload stateDistribution={stateDistribution} /> <ProfileWorkload stateDistribution={stateDistribution} />
<div className="grid grid-cols-1 items-stretch gap-5 xl:grid-cols-2"> <div className="grid grid-cols-1 items-stretch gap-5 xl:grid-cols-2">
<ProfilePriorityDistribution priorityDistribution={userProfile?.priority_distribution} /> <ProfilePriorityDistribution userProfile={userProfile} />
<ProfileStateDistribution stateDistribution={stateDistribution} userProfile={userProfile} /> <ProfileStateDistribution stateDistribution={stateDistribution} userProfile={userProfile} />
</div> </div>
<ProfileActivity /> <ProfileActivity />

View File

@ -66,7 +66,7 @@ const CreateWorkspacePage: NextPageWithLayout = observer(() => {
<CreateWorkspaceForm <CreateWorkspaceForm
onSubmit={onSubmit} onSubmit={onSubmit}
defaultValues={defaultValues} defaultValues={defaultValues}
setDefaultValues={setDefaultValues} setDefaultValues={setDefaultValues as any}
/> />
</div> </div>
</div> </div>