style: updated the UI of the instance admin setup and the sign in workflow (#2962)

* style: updated the UI of the signin and instance setups

* fix: form validations and mutations

* fix: updated Link tags in accordance to next v14

* chore: latest features image, reset password redirection
This commit is contained in:
Aaryan Khandelwal 2023-12-01 15:50:01 +05:30 committed by GitHub
parent eca96da837
commit 332e56bb0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 717 additions and 575 deletions

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import Link from "next/link";
import { Controller, useForm } from "react-hook-form"; import { Controller, useForm } from "react-hook-form";
// services // services
import { AuthService } from "services/auth.service"; import { AuthService } from "services/auth.service";
@ -74,7 +75,7 @@ export const CreatePasswordForm: React.FC<Props> = (props) => {
return ( return (
<> <>
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-onboarding-text-100"> <h1 className="text-center text-2xl sm:text-2.5xl font-medium text-onboarding-text-100">
Let{"'"}s get a new password Let{"'"}s get a new password
</h1> </h1>
@ -117,16 +118,23 @@ export const CreatePasswordForm: React.FC<Props> = (props) => {
hasError={Boolean(errors.password)} hasError={Boolean(errors.password)}
placeholder="Create password" placeholder="Create password"
className="w-full h-[46px] placeholder:text-onboarding-text-400 border border-onboarding-border-100 pr-12" className="w-full h-[46px] placeholder:text-onboarding-text-400 border border-onboarding-border-100 pr-12"
minLength={8}
/> />
)} )}
/> />
<p className="text-xs text-onboarding-text-200 mt-3"> <p className="text-xs text-onboarding-text-200 mt-3 pb-2">
Whatever you choose now will be your account{"'"}s password until you change it. Whatever you choose now will be your account{"'"}s password until you change it.
</p> </p>
</div> </div>
<Button type="submit" variant="primary" className="w-full" size="xl" disabled={!isValid} loading={isSubmitting}> <Button type="submit" variant="primary" className="w-full" size="xl" disabled={!isValid} loading={isSubmitting}>
{isSubmitting ? "Submitting..." : "Go to workspace"} {isSubmitting ? "Submitting..." : "Go to workspace"}
</Button> </Button>
<p className="text-xs text-onboarding-text-200">
When you click the button above, you agree with our{" "}
<Link href="https://plane.so/terms-and-conditions" target="_blank" rel="noopener noreferrer">
<span className="font-semibold underline">terms and conditions of service.</span>
</Link>
</p>
</form> </form>
</> </>
); );

View File

@ -83,10 +83,10 @@ export const EmailForm: React.FC<Props> = (props) => {
return ( return (
<> <>
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-onboarding-text-100"> <h1 className="text-center text-2xl sm:text-2.5xl font-medium text-onboarding-text-100">
Get on your flight deck! Get on your flight deck!
</h1> </h1>
<p className="text-center text-sm text-onboarding-text-200 px-20 mt-3"> <p className="text-center text-sm text-onboarding-text-200 mt-3">
Sign in with the email you used to sign up for Plane Sign in with the email you used to sign up for Plane
</p> </p>

View File

@ -1,4 +1,5 @@
import React, { useState } from "react"; import React, { useState } from "react";
import Link from "next/link";
import { Controller, useForm } from "react-hook-form"; import { Controller, useForm } from "react-hook-form";
// ui // ui
import { Button, Input } from "@plane/ui"; import { Button, Input } from "@plane/ui";
@ -37,12 +38,12 @@ export const OptionalSetPasswordForm: React.FC<Props> = (props) => {
return ( return (
<> <>
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-onboarding-text-100">Set a password</h1> <h1 className="text-center text-2xl sm:text-2.5xl font-medium text-onboarding-text-100">Set a password</h1>
<p className="text-center text-sm text-onboarding-text-200 px-20 mt-3"> <p className="text-center text-sm text-onboarding-text-200 px-20 mt-3">
If you{"'"}d to do away with codes, set a password here. If you{"'"}d to do away with codes, set a password here
</p> </p>
<form className="mt-5 sm:w-96 mx-auto"> <form className="mt-5 sm:w-96 mx-auto space-y-4">
<Controller <Controller
control={control} control={control}
name="email" name="email"
@ -65,7 +66,7 @@ export const OptionalSetPasswordForm: React.FC<Props> = (props) => {
/> />
)} )}
/> />
<div className="grid grid-cols-2 gap-2.5 mt-4"> <div className="grid grid-cols-2 gap-2.5">
<Button <Button
type="button" type="button"
variant="primary" variant="primary"
@ -88,6 +89,12 @@ export const OptionalSetPasswordForm: React.FC<Props> = (props) => {
{isGoingToWorkspace ? "Going to app..." : "Go to workspace"} {isGoingToWorkspace ? "Going to app..." : "Go to workspace"}
</Button> </Button>
</div> </div>
<p className="text-xs text-onboarding-text-200">
When you click <span className="text-custom-primary-100">Go to workspace</span> above, you agree with our{" "}
<Link href="https://plane.so/terms-and-conditions" target="_blank" rel="noopener noreferrer">
<span className="font-semibold underline">terms and conditions of service.</span>
</Link>
</p>
</form> </form>
</> </>
); );

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import Link from "next/link";
import { Controller, useForm } from "react-hook-form"; import { Controller, useForm } from "react-hook-form";
import { XCircle } from "lucide-react"; import { XCircle } from "lucide-react";
// services // services
@ -184,17 +185,25 @@ export const PasswordForm: React.FC<Props> = (props) => {
/> />
)} )}
/> />
<button <div className="w-full text-right">
type="button" <button
onClick={handleForgotPassword} type="button"
className="text-xs font-medium text-right w-full text-custom-primary-100" onClick={handleForgotPassword}
> className="text-xs font-medium text-custom-primary-100"
Forgot your password? >
</button> Forgot your password?
</button>
</div>
</div> </div>
<Button type="submit" variant="primary" className="w-full" size="xl" disabled={!isValid} loading={isSubmitting}> <Button type="submit" variant="primary" className="w-full" size="xl" disabled={!isValid} loading={isSubmitting}>
{isSubmitting ? "Signing in..." : "Go to workspace"} {isSubmitting ? "Signing in..." : "Go to workspace"}
</Button> </Button>
<p className="text-xs text-onboarding-text-200">
When you click the button above, you agree with our{" "}
<Link href="https://plane.so/terms-and-conditions" target="_blank" rel="noopener noreferrer">
<span className="font-semibold underline">terms and conditions of service.</span>
</Link>
</p>
</form> </form>
</> </>
); );

View File

@ -23,6 +23,8 @@ type Props = {
handleSignInRedirection: () => Promise<void>; handleSignInRedirection: () => Promise<void>;
}; };
const OAUTH_HIDDEN_STEPS = [ESignInSteps.OPTIONAL_SET_PASSWORD, ESignInSteps.CREATE_PASSWORD];
export const SignInRoot: React.FC<Props> = (props) => { export const SignInRoot: React.FC<Props> = (props) => {
const { handleSignInRedirection } = props; const { handleSignInRedirection } = props;
// states // states
@ -72,7 +74,7 @@ export const SignInRoot: React.FC<Props> = (props) => {
/> />
)} )}
</div> </div>
{signInStep !== ESignInSteps.OPTIONAL_SET_PASSWORD && ( {!OAUTH_HIDDEN_STEPS.includes(signInStep) && (
<OAuthOptions <OAuthOptions
updateEmail={(newEmail) => setEmail(newEmail)} updateEmail={(newEmail) => setEmail(newEmail)}
handleStepChange={(step: ESignInSteps) => setSignInStep(step)} handleStepChange={(step: ESignInSteps) => setSignInStep(step)}

View File

@ -1,4 +1,5 @@
import React, { useState } from "react"; import React, { useState } from "react";
import Link from "next/link";
import { Controller, useForm } from "react-hook-form"; import { Controller, useForm } from "react-hook-form";
import { XCircle } from "lucide-react"; import { XCircle } from "lucide-react";
// services // services
@ -48,6 +49,13 @@ export const SetPasswordLink: React.FC<Props> = (props) => {
await authService await authService
.emailCheck(payload) .emailCheck(payload)
.then(() =>
setToastAlert({
type: "success",
title: "Success!",
message: "We have sent a new link to your email.",
})
)
.catch((err) => .catch((err) =>
setToastAlert({ setToastAlert({
type: "error", type: "error",
@ -60,15 +68,15 @@ export const SetPasswordLink: React.FC<Props> = (props) => {
return ( return (
<> <>
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-onboarding-text-100"> <h1 className="text-center text-2xl sm:text-2.5xl font-medium text-onboarding-text-100">
Get on your flight deck! Get on your flight deck
</h1> </h1>
<p className="text-center text-sm text-onboarding-text-200 px-20 mt-3"> <p className="text-center text-sm text-onboarding-text-200 px-20 mt-3">
We have sent a link to <span className="font-medium text-custom-primary-100">{email},</span> so you can set a We have sent a link to <span className="font-semibold text-custom-primary-100">{email},</span> so you can set a
password password
</p> </p>
<form className="mt-5 sm:w-96 mx-auto"> <form className="mt-5 sm:w-96 mx-auto space-y-4">
<div className="space-y-1"> <div className="space-y-1">
<Controller <Controller
control={control} control={control}
@ -103,19 +111,23 @@ export const SetPasswordLink: React.FC<Props> = (props) => {
)} )}
/> />
</div> </div>
<div className="mt-4"> <Button
<Button type="button"
type="button" variant="primary"
variant="primary" className="w-full"
className="w-full" size="xl"
size="xl" onClick={handleSendNewLink}
onClick={handleSendNewLink} disabled={!isValid}
disabled={!isValid} loading={isSendingNewLink}
loading={isSendingNewLink} >
> {isSendingNewLink ? "Sending new link..." : "Get link again"}
{isSendingNewLink ? "Sending new link..." : "Get link again"} </Button>
</Button> <p className="text-xs text-onboarding-text-200">
</div> When you click the button above, you agree with our{" "}
<Link href="https://plane.so/terms-and-conditions" target="_blank" rel="noopener noreferrer">
<span className="font-semibold underline">terms and conditions of service.</span>
</Link>
</p>
</form> </form>
</> </>
); );

View File

@ -1,4 +1,5 @@
import React, { useState } from "react"; import React, { useState } from "react";
import Link from "next/link";
import { Controller, useForm } from "react-hook-form"; import { Controller, useForm } from "react-hook-form";
import { CornerDownLeft, XCircle } from "lucide-react"; import { CornerDownLeft, XCircle } from "lucide-react";
// services // services
@ -44,7 +45,7 @@ export const UniqueCodeForm: React.FC<Props> = (props) => {
// toast alert // toast alert
const { setToastAlert } = useToast(); const { setToastAlert } = useToast();
// timer // timer
const { timer: resendTimerCode, setTimer: setResendCodeTimer } = useTimer(); const { timer: resendTimerCode, setTimer: setResendCodeTimer } = useTimer(30);
// form info // form info
const { const {
control, control,
@ -131,11 +132,9 @@ export const UniqueCodeForm: React.FC<Props> = (props) => {
return ( return (
<> <>
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-onboarding-text-100"> <h1 className="text-center text-2xl sm:text-2.5xl font-medium text-onboarding-text-100">Moving to the runway</h1>
Moving to the runway <p className="text-center text-sm text-onboarding-text-200 mt-3">
</h1> Paste the code you got at <span className="font-semibold text-custom-primary-100">{email}</span> below
<p className="text-center text-sm text-onboarding-text-200 px-20 mt-3">
Paste the code you got at <span className="font-medium text-custom-primary-100">{email}</span> below.
</p> </p>
<form onSubmit={handleSubmit(handleFormSubmit)} className="mt-5 sm:w-96 mx-auto space-y-4"> <form onSubmit={handleSubmit(handleFormSubmit)} className="mt-5 sm:w-96 mx-auto space-y-4">
@ -201,20 +200,24 @@ export const UniqueCodeForm: React.FC<Props> = (props) => {
/> />
)} )}
/> />
<button <div className="w-full text-right">
type="button" <button
onClick={handleRequestNewCode} type="button"
className={`text-xs text-right w-full text-onboarding-text-200 ${ onClick={handleRequestNewCode}
isRequestNewCodeDisabled ? "" : "hover:text-custom-primary-100" className={`text-xs ${
}`} isRequestNewCodeDisabled
disabled={isRequestNewCodeDisabled} ? "text-onboarding-text-300"
> : "text-onboarding-text-200 hover:text-custom-primary-100"
{resendTimerCode > 0 }`}
? `Request new code in ${resendTimerCode}s` disabled={isRequestNewCodeDisabled}
: isRequestingNewCode >
? "Requesting new code..." {resendTimerCode > 0
: "Request new code"} ? `Request new code in ${resendTimerCode}s`
</button> : isRequestingNewCode
? "Requesting new code..."
: "Request new code"}
</button>
</div>
</div> </div>
<Button <Button
type="submit" type="submit"
@ -226,6 +229,12 @@ export const UniqueCodeForm: React.FC<Props> = (props) => {
> >
{isSubmitting ? "Signing in..." : "Confirm"} {isSubmitting ? "Signing in..." : "Confirm"}
</Button> </Button>
<p className="text-xs text-onboarding-text-200">
When you click Confirm above, you agree with our{" "}
<Link href="https://plane.so/terms-and-conditions" target="_blank" rel="noopener noreferrer">
<span className="font-semibold underline">terms and conditions of service.</span>
</Link>
</p>
</form> </form>
</> </>
); );

View File

@ -1,34 +1,35 @@
import Image from "next/image"; import Image from "next/image";
import Link from "next/link";
import { useTheme } from "next-themes"; import { useTheme } from "next-themes";
// icons // icons
import { Lightbulb } from "lucide-react"; import { Lightbulb } from "lucide-react";
// images // images
import signInIssues from "public/onboarding/onboarding-issues.svg"; import latestFeatures from "public/onboarding/onboarding-pages.svg";
export const LatestFeatureBlock = () => { export const LatestFeatureBlock = () => {
const { resolvedTheme } = useTheme(); const { resolvedTheme } = useTheme();
return ( return (
<> <>
<div <div className="flex py-2 bg-onboarding-background-100 border border-onboarding-border-200 mx-auto rounded-[3.5px] sm:w-96 mt-16">
className={`flex py-2 bg-onboarding-background-100 border border-onboarding-border-200 mx-auto rounded-[3.5px] sm:w-96 mt-16`}
>
<Lightbulb className="h-7 w-7 mr-2 mx-3" /> <Lightbulb className="h-7 w-7 mr-2 mx-3" />
<p className={`text-sm text-left text-onboarding-text-100`}> <p className="text-sm text-left text-onboarding-text-100">
Try the latest features, like Tiptap editor, to write compelling responses.{" "} Pages gets a facelift! Write anything and use Galileo to help you start.{" "}
<span className="font-medium text-sm underline hover:cursor-pointer" onClick={() => {}}> <Link href="https://plane.so/changelog" target="_blank" rel="noopener noreferrer">
See new features <span className="font-medium text-sm underline hover:cursor-pointer">Learn more</span>
</span> </Link>
</p> </p>
</div> </div>
<div className="flex justify-center border border-onboarding-border-200 sm:w-96 sm:h-52 object-cover mt-8 mx-auto rounded-md bg-onboarding-background-100 "> <div className="border border-onboarding-border-200 sm:w-96 sm:h-52 object-cover mt-8 mx-auto rounded-md bg-onboarding-background-100 overflow-hidden">
<Image <div className="h-[90%]">
src={signInIssues} <Image
alt="Plane Issues" src={latestFeatures}
className={`flex object-cover rounded-md ${ alt="Plane Issues"
resolvedTheme === "dark" ? "bg-onboarding-background-100" : "bg-custom-primary-70" className={`rounded-md h-full ml-8 -mt-2 ${
} `} resolvedTheme === "dark" ? "bg-onboarding-background-100" : "bg-custom-primary-70"
/> } `}
/>
</div>
</div> </div>
</> </>
); );

View File

@ -33,7 +33,10 @@ export interface ICyclesBoardCard {
export const CyclesBoardCard: FC<ICyclesBoardCard> = (props) => { export const CyclesBoardCard: FC<ICyclesBoardCard> = (props) => {
const { cycle, workspaceSlug, projectId } = props; const { cycle, workspaceSlug, projectId } = props;
// store // store
const { cycle: cycleStore, trackEvent: { setTrackElement } } = useMobxStore(); const {
cycle: cycleStore,
trackEvent: { setTrackElement },
} = useMobxStore();
// toast // toast
const { setToastAlert } = useToast(); const { setToastAlert } = useToast();
// states // states
@ -152,7 +155,7 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = (props) => {
/> />
<Link href={`/${workspaceSlug}/projects/${projectId}/cycles/${cycle.id}`}> <Link href={`/${workspaceSlug}/projects/${projectId}/cycles/${cycle.id}`}>
<span className="flex flex-col justify-between p-4 h-44 w-full min-w-[250px] text-sm rounded bg-custom-background-100 border border-custom-border-100 hover:shadow-md"> <div className="flex flex-col justify-between p-4 h-44 w-full min-w-[250px] text-sm rounded bg-custom-background-100 border border-custom-border-100 hover:shadow-md">
<div className="flex items-center justify-between gap-2"> <div className="flex items-center justify-between gap-2">
<div className="flex items-center gap-3 truncate"> <div className="flex items-center gap-3 truncate">
<span className="flex-shrink-0"> <span className="flex-shrink-0">
@ -268,7 +271,7 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = (props) => {
</div> </div>
</div> </div>
</div> </div>
</span> </div>
</Link> </Link>
</div> </div>
); );

View File

@ -153,7 +153,7 @@ export const CyclesListItem: FC<TCyclesListItem> = (props) => {
projectId={projectId} projectId={projectId}
/> />
<Link href={`/${workspaceSlug}/projects/${projectId}/cycles/${cycle.id}`}> <Link href={`/${workspaceSlug}/projects/${projectId}/cycles/${cycle.id}`}>
<span className="group flex items-center justify-between gap-5 px-5 py-6 h-16 w-full text-sm bg-custom-background-100 border-b border-custom-border-100 hover:bg-custom-background-90"> <div className="group flex items-center justify-between gap-5 px-5 py-6 h-16 w-full text-sm bg-custom-background-100 border-b border-custom-border-100 hover:bg-custom-background-90">
<div className="flex items-center gap-3 w-full truncate"> <div className="flex items-center gap-3 w-full truncate">
<div className="flex items-center gap-4 truncate"> <div className="flex items-center gap-4 truncate">
<span className="flex-shrink-0"> <span className="flex-shrink-0">
@ -262,7 +262,7 @@ export const CyclesListItem: FC<TCyclesListItem> = (props) => {
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
</CustomMenu> </CustomMenu>
</div> </div>
</span> </div>
</Link> </Link>
</> </>
); );

View File

@ -27,71 +27,69 @@ export const InboxIssueCard: React.FC<Props> = (props) => {
return ( return (
<Link href={`/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}?inboxIssueId=${issue.issue_inbox[0].id}`}> <Link href={`/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}?inboxIssueId=${issue.issue_inbox[0].id}`}>
<span> <div
<div id={issue.id}
id={issue.id} className={`relative min-h-[5rem] cursor-pointer select-none space-y-3 py-2 px-4 border-b border-custom-border-200 hover:bg-custom-primary/5 ${
className={`relative min-h-[5rem] cursor-pointer select-none space-y-3 py-2 px-4 border-b border-custom-border-200 hover:bg-custom-primary/5 ${ active ? "bg-custom-primary/5" : " "
active ? "bg-custom-primary/5" : " " } ${issue.issue_inbox[0].status !== -2 ? "opacity-60" : ""}`}
} ${issue.issue_inbox[0].status !== -2 ? "opacity-60" : ""}`} >
> <div className="flex items-center gap-x-2">
<div className="flex items-center gap-x-2"> <p className="flex-shrink-0 text-custom-text-200 text-xs">
<p className="flex-shrink-0 text-custom-text-200 text-xs"> {issue.project_detail?.identifier}-{issue.sequence_id}
{issue.project_detail?.identifier}-{issue.sequence_id} </p>
</p> <h5 className="truncate text-sm">{issue.name}</h5>
<h5 className="truncate text-sm">{issue.name}</h5>
</div>
<div className="flex items-center gap-2 flex-wrap">
<Tooltip tooltipHeading="Priority" tooltipContent={`${issue.priority ?? "None"}`}>
<PriorityIcon priority={issue.priority ?? null} className="h-3.5 w-3.5" />
</Tooltip>
<Tooltip
tooltipHeading="Created on"
tooltipContent={`${renderShortDateWithYearFormat(issue.created_at ?? "")}`}
>
<div className="flex items-center gap-1 rounded border border-custom-border-200 shadow-sm text-xs px-2 py-[0.19rem] text-custom-text-200">
<CalendarDays size={12} strokeWidth={1.5} />
<span>{renderShortDateWithYearFormat(issue.created_at ?? "")}</span>
</div>
</Tooltip>
</div>
<div
className={`text-xs flex items-center justify-end gap-1 w-full ${
issueStatus === 0 && new Date(issue.issue_inbox[0].snoozed_till ?? "") < new Date()
? "text-red-500"
: INBOX_STATUS.find((s) => s.value === issueStatus)?.textColor
}`}
>
{issueStatus === -2 ? (
<>
<AlertTriangle size={14} strokeWidth={2} />
<span>Pending</span>
</>
) : issueStatus === -1 ? (
<>
<XCircle size={14} strokeWidth={2} />
<span>Declined</span>
</>
) : issueStatus === 0 ? (
<>
<Clock size={14} strokeWidth={2} />
<span>
{new Date(issue.issue_inbox[0].snoozed_till ?? "") < new Date() ? "Snoozed date passed" : "Snoozed"}
</span>
</>
) : issueStatus === 1 ? (
<>
<CheckCircle2 size={14} strokeWidth={2} />
<span>Accepted</span>
</>
) : (
<>
<Copy size={14} strokeWidth={2} />
<span>Duplicate</span>
</>
)}
</div>
</div> </div>
</span> <div className="flex items-center gap-2 flex-wrap">
<Tooltip tooltipHeading="Priority" tooltipContent={`${issue.priority ?? "None"}`}>
<PriorityIcon priority={issue.priority ?? null} className="h-3.5 w-3.5" />
</Tooltip>
<Tooltip
tooltipHeading="Created on"
tooltipContent={`${renderShortDateWithYearFormat(issue.created_at ?? "")}`}
>
<div className="flex items-center gap-1 rounded border border-custom-border-200 shadow-sm text-xs px-2 py-[0.19rem] text-custom-text-200">
<CalendarDays size={12} strokeWidth={1.5} />
<span>{renderShortDateWithYearFormat(issue.created_at ?? "")}</span>
</div>
</Tooltip>
</div>
<div
className={`text-xs flex items-center justify-end gap-1 w-full ${
issueStatus === 0 && new Date(issue.issue_inbox[0].snoozed_till ?? "") < new Date()
? "text-red-500"
: INBOX_STATUS.find((s) => s.value === issueStatus)?.textColor
}`}
>
{issueStatus === -2 ? (
<>
<AlertTriangle size={14} strokeWidth={2} />
<span>Pending</span>
</>
) : issueStatus === -1 ? (
<>
<XCircle size={14} strokeWidth={2} />
<span>Declined</span>
</>
) : issueStatus === 0 ? (
<>
<Clock size={14} strokeWidth={2} />
<span>
{new Date(issue.issue_inbox[0].snoozed_till ?? "") < new Date() ? "Snoozed date passed" : "Snoozed"}
</span>
</>
) : issueStatus === 1 ? (
<>
<CheckCircle2 size={14} strokeWidth={2} />
<span>Accepted</span>
</>
) : (
<>
<Copy size={14} strokeWidth={2} />
<span>Duplicate</span>
</>
)}
</div>
</div>
</Link> </Link>
); );
}; };

View File

@ -98,12 +98,12 @@ export const InstanceHelpSection: FC = () => {
if (href) if (href)
return ( return (
<Link href={href} key={name} target="_blank"> <Link href={href} key={name} target="_blank">
<span className="flex items-center gap-x-2 rounded px-2 py-1 text-xs hover:bg-custom-background-80"> <div className="flex items-center gap-x-2 rounded px-2 py-1 text-xs hover:bg-custom-background-80">
<div className="grid place-items-center flex-shrink-0"> <div className="grid place-items-center flex-shrink-0">
<Icon className="text-custom-text-200 h-3.5 w-3.5" size={14} /> <Icon className="text-custom-text-200 h-3.5 w-3.5" size={14} />
</div> </div>
<span className="text-xs">{name}</span> <span className="text-xs">{name}</span>
</span> </div>
</Link> </Link>
); );
else else

View File

@ -67,12 +67,10 @@ export const InstanceAdminRestriction: FC<InstanceAdminRestrictionProps> = ({ re
</div> </div>
<div className="flex items-center justify-center gap-2"> <div className="flex items-center justify-center gap-2">
<Link href={`/${redirectWorkspaceSlug}`}> <Link href={`/${redirectWorkspaceSlug}`}>
<span> <Button variant="primary" size="sm">
<Button variant="primary" size="sm"> <LayoutGrid width={16} height={16} />
<LayoutGrid width={16} height={16} /> To the workspace
To the workspace </Button>
</Button>
</span>
</Link> </Link>
</div> </div>
</div> </div>

View File

@ -1,29 +1,29 @@
import React from "react"; import React from "react";
import Image from "next/image"; import Image from "next/image";
import { useTheme } from "next-themes"; import { useTheme } from "next-themes";
// image // images
import instanceNotReady from "public/instance/plane-instance-not-ready.webp"; import instanceNotReady from "public/instance/plane-instance-not-ready.webp";
import PlaneWhiteLogo from "public/plane-logos/white-horizontal-with-blue-logo.svg"; import PlaneWhiteLogo from "public/plane-logos/white-horizontal-with-blue-logo.svg";
import PlaneDarkLogo from "public/plane-logos/black-horizontal-with-blue-logo.svg"; import PlaneBlackLogo from "public/plane-logos/black-horizontal-with-blue-logo.svg";
export const InstanceNotReady = () => { export const InstanceNotReady = () => {
const { resolvedTheme } = useTheme(); const { resolvedTheme } = useTheme();
const planeLogo = resolvedTheme === "dark" ? PlaneWhiteLogo : PlaneDarkLogo; const planeLogo = resolvedTheme === "dark" ? PlaneWhiteLogo : PlaneBlackLogo;
return ( return (
<div className="h-screen w-full overflow-y-auto bg-onboarding-gradient-100"> <div className="h-screen w-full overflow-y-auto bg-onboarding-gradient-100">
<div className={`h-screen w-full pt-24`}> <div className="h-full w-full pt-24">
<div className="h-auto bg-onboarding-gradient-100 md:w-2/3 sm:w-4/5 p-4 rounded-md mx-auto shadow-sm border border-custom-border-100 "> <div className="h-full bg-onboarding-gradient-100 md:w-2/3 sm:w-4/5 px-4 pt-4 rounded-t-md mx-auto shadow-sm border-x border-t border-custom-border-100">
<div className={`relative px-7 sm:px-0 bg-onboarding-gradient-200 h-full rounded-md`}> <div className="relative px-7 sm:px-0 bg-onboarding-gradient-200 h-full rounded-t-md">
<div className="flex items-center py-10 justify-center"> <div className="flex items-center py-10 justify-center">
<Image src={planeLogo} className="h-44 w-full" alt="image" /> <Image src={planeLogo} className="h-44 w-full" alt="Plane logo" />
</div> </div>
<div className="mt-20"> <div className="mt-20">
<Image src={instanceNotReady} className="h-46 w-full" alt="image" /> <Image src={instanceNotReady} className="h-56 w-full" alt="Instance not ready" />
</div> </div>
<div className="flex flex-col gap-5 items-center py-12 pb-20 w-full"> <div className="flex flex-col gap-5 items-center py-12 pb-20 w-full">
<h3 className="text-2xl font-medium">Your Plane instance isnt ready yet</h3> <h3 className="text-2xl font-medium">Your Plane instance isn{"'"}t ready yet</h3>
<p className="text-sm">Ask your Instance Admin to complete set-up first.</p> <p className="text-sm">Ask your Instance Admin to complete set-up first.</p>
</div> </div>
</div> </div>

View File

@ -1,43 +1,66 @@
import React from "react"; import React, { useState } from "react";
import Image from "next/image"; import Image from "next/image";
import { useTheme } from "next-themes";
// ui // ui
import { Button } from "@plane/ui"; import { Button } from "@plane/ui";
import { UserCog2 } from "lucide-react"; import { UserCog2 } from "lucide-react";
// image // images
import instanceSetupDone from "public/instance-setup-done.svg"; import instanceSetupDone from "public/instance-setup-done.svg";
import PlaneLogo from "public/plane-logos/blue-without-text.png"; import PlaneBlackLogo from "public/plane-logos/black-horizontal-with-blue-logo.svg";
import PlaneWhiteLogo from "public/plane-logos/white-horizontal-with-blue-logo.svg";
import { useMobxStore } from "lib/mobx/store-provider";
export const InstanceSetupDone = () => ( export const InstanceSetupDone = () => {
<div className="h-screen w-full overflow-hidden"> // states
<div className={`bg-onboarding-gradient-100 h-screen w-full pt-12`}> const [isRedirecting, setIsRedirecting] = useState(false);
<div className="h-full bg-onboarding-gradient-100 md:w-2/3 sm:w-4/5 px-4 pt-4 rounded-t-md mx-auto shadow-sm border-x border-t border-custom-border-200 "> // next-themes
<div const { resolvedTheme } = useTheme();
className={`flex flex-col items-center relative px-7 sm:px-0 bg-onboarding-gradient-200 h-full rounded-t-md overflow-auto`} // mobx store
> const {
<div className="flex items-center gap-5 py-10 justify-center"> instance: { fetchInstanceInfo },
<Image src={PlaneLogo} height={44} width={44} alt="image" /> } = useMobxStore();
<span className="text-4xl font-semibold">To the stratosphere now!</span>
</div>
<div className="flex items-center justify-center"> const planeLogo = resolvedTheme === "dark" ? PlaneWhiteLogo : PlaneBlackLogo;
<Image src={instanceSetupDone} height={360} width={444} alt="image" />
</div>
<div className="flex flex-col gap-8 items-center py-12 w-full"> const redirectToGodMode = async () => {
<span className="text-xl font-medium"> setIsRedirecting(true);
Your instance is now ready for more security, more controls, and more intelligence.
</span>
<Button size="lg" prependIcon={<UserCog2 />}>
Go to God Mode
</Button>
<div className="flex p-2.5 text-custom-primary-100 bg-custom-primary-10 border border-custom-primary-100 text-sm text-left mx-auto rounded"> await fetchInstanceInfo().finally(() => setIsRedirecting(false));
Use this wisely. Remember, with great power comes great responsibility.🕷 };
return (
<div className="h-full w-full overflow-hidden">
<div className="bg-onboarding-gradient-100 h-full w-full pt-12 overflow-hidden">
<div className="h-full bg-onboarding-gradient-100 md:w-2/3 sm:w-4/5 px-4 pt-4 rounded-t-md mx-auto shadow-sm border-x border-t border-custom-border-200 overflow-hidden">
<div className="flex flex-col items-center relative px-7 sm:px-0 bg-onboarding-gradient-200 h-full rounded-t-md overflow-y-auto pb-8">
<div className="flex py-10 justify-center">
<div className="h-[30px]">
<Image src={planeLogo} className="h-full w-full" alt="Plane logo" />
</div>
</div>
<div className="grid place-items-center my-8">
<div className="w-[444px]">
<Image src={instanceSetupDone} className="h-full w-full" alt="image" />
</div>
</div>
<div className="flex flex-col gap-8 items-center w-full sm:px-4">
<div className="bg-purple-500/20 border border-purple-500 py-2.5 px-3 rounded text-center space-y-3">
<h6 className="text-base font-semibold">
Your instance is now ready for more security, more controls, and more intelligence.
</h6>
<p className="text-xs font-medium">
Use this wisely. Remember, with great power comes great responsibility.
</p>
</div>
<Button size="lg" prependIcon={<UserCog2 />} onClick={redirectToGodMode} loading={isRedirecting}>
{isRedirecting ? "Redirecting..." : "Go to God Mode"}
</Button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> );
); };

View File

@ -1,4 +1,4 @@
import { FC } from "react"; import { FC, useState } from "react";
import { useForm, Controller } from "react-hook-form"; import { useForm, Controller } from "react-hook-form";
// ui // ui
import { Input, Button } from "@plane/ui"; import { Input, Button } from "@plane/ui";
@ -24,6 +24,8 @@ export interface IInstanceSetupEmailCodeForm {
export const InstanceSetupEmailCodeForm: FC<IInstanceSetupEmailCodeForm> = (props) => { export const InstanceSetupEmailCodeForm: FC<IInstanceSetupEmailCodeForm> = (props) => {
const { handleNextStep, email, moveBack } = props; const { handleNextStep, email, moveBack } = props;
// states
const [isResendingCode, setIsResendingCode] = useState(false);
// form info // form info
const { const {
control, control,
@ -40,10 +42,10 @@ export const InstanceSetupEmailCodeForm: FC<IInstanceSetupEmailCodeForm> = (prop
const { setToastAlert } = useToast(); const { setToastAlert } = useToast();
const { timer, setTimer } = useTimer(30); const { timer, setTimer } = useTimer(30);
// computed // computed
const isResendDisabled = timer > 0 || isSubmitting; const isResendDisabled = timer > 0 || isResendingCode;
const handleEmailCodeFormSubmit = (formValues: InstanceSetupEmailCodeFormValues) => const handleEmailCodeFormSubmit = async (formValues: InstanceSetupEmailCodeFormValues) =>
authService await authService
.instanceMagicSignIn({ key: `magic_${formValues.email}`, token: formValues.token }) .instanceMagicSignIn({ key: `magic_${formValues.email}`, token: formValues.token })
.then(() => { .then(() => {
reset(); reset();
@ -51,42 +53,40 @@ export const InstanceSetupEmailCodeForm: FC<IInstanceSetupEmailCodeForm> = (prop
}) })
.catch((err) => { .catch((err) => {
setToastAlert({ setToastAlert({
title: "Oops!",
type: "error", type: "error",
message: err?.error, title: "Error!",
message: err?.error ?? "Something went wrong. Please try again.",
}); });
}); });
const resendMagicCode = () => { const resendMagicCode = async () => {
setTimer(30); setIsResendingCode(true);
authService
await authService
.instanceAdminEmailCode({ email }) .instanceAdminEmailCode({ email })
.then(() => { .then(() => setTimer(30))
// setCodeResending(false);
setTimer(30);
})
.catch((err) => { .catch((err) => {
setToastAlert({ setToastAlert({
title: "Oops!",
type: "error", type: "error",
message: err?.error, title: "Error!",
message: err?.error ?? "Something went wrong. Please try again.",
}); });
}); })
.finally(() => setIsResendingCode(false));
}; };
return ( return (
<form onSubmit={handleSubmit(handleEmailCodeFormSubmit)}> <form onSubmit={handleSubmit(handleEmailCodeFormSubmit)}>
<div className="pb-2"> <h1 className="text-center text-2xl sm:text-2.5xl font-medium text-onboarding-text-100">
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-onboarding-text-100"> Let{"'"}s secure your instance
Lets secure your instance </h1>
</h1> <p className="text-center text-sm text-onboarding-text-200 mt-3">
<div className="text-center text-sm text-onboarding-text-200 mt-3"> Paste the code you got at
<p>Paste the code you got at </p> <br />
<span className="text-center text-sm text-custom-primary-80 mt-1 font-semibold ">{email}</span> <span className="text-custom-primary-100 font-semibold">{email}</span> below.
<span className="text-onboarding-text-200">below.</span> </p>
</div> <div className="relative mt-5 w-full sm:w-96 mx-auto space-y-4">
<div>
<div className="relative mt-10 w-full sm:w-[360px] mx-auto">
<Controller <Controller
name="email" name="email"
control={control} control={control}
@ -98,7 +98,7 @@ export const InstanceSetupEmailCodeForm: FC<IInstanceSetupEmailCodeForm> = (prop
) || "Email address is not valid", ) || "Email address is not valid",
}} }}
render={({ field: { value, onChange } }) => ( render={({ field: { value, onChange } }) => (
<div className={`flex items-center relative rounded-md bg-onboarding-background-200 mb-4`}> <div className="flex items-center relative rounded-md bg-onboarding-background-200">
<Input <Input
id="email" id="email"
name="email" name="email"
@ -116,51 +116,44 @@ export const InstanceSetupEmailCodeForm: FC<IInstanceSetupEmailCodeForm> = (prop
</div> </div>
)} )}
/> />
<div <div className="w-full text-right">
className={`flex w-full justify-end text-xs outline-none ${ <button
isResendDisabled ? "cursor-default text-custom-text-200" : "cursor-pointer text-custom-primary-100" type="button"
} `} onClick={resendMagicCode}
> className={`text-xs ${
{timer > 0 ? ( isResendDisabled ? "text-onboarding-text-300" : "text-onboarding-text-200 hover:text-custom-primary-100"
<span className="text-right">Request new code in {timer}s</span> }`}
) : isSubmitting ? ( disabled={isResendDisabled}
"Sending new code..." >
) : ( {timer > 0
<div className="flex justify-end w-full"> ? `Request new code in ${timer}s`
<button : isSubmitting
type="button" ? "Requesting new code..."
className="w-fit pb-2 text-xs outline-none cursor-pointer text-custom-primary-100" : "Request new code"}
onClick={resendMagicCode} </button>
disabled={isResendDisabled}
>
<span className="font-medium">Resend</span>
</button>
</div>
)}
</div> </div>
<Controller
name="token"
control={control}
rules={{ required: true }}
render={({ field: { value, onChange } }) => (
<div className={`flex items-center relative rounded-md bg-onboarding-background-200 mb-4`}>
<Input
id="token"
name="token"
type="text"
value={value}
onChange={onChange}
placeholder="gets-sets-flys"
className="border-onboarding-border-100 h-[46px] w-full "
/>
</div>
)}
/>
<Button variant="primary" className="w-full mt-4" size="xl" type="submit" loading={isSubmitting}>
{isSubmitting ? "Verifying..." : "Next step"}
</Button>
</div> </div>
<Controller
name="token"
control={control}
rules={{ required: true }}
render={({ field: { value, onChange } }) => (
<div className={`flex items-center relative rounded-md bg-onboarding-background-200 mb-4`}>
<Input
id="token"
name="token"
type="text"
value={value}
onChange={onChange}
placeholder="gets-sets-fays"
className="border-onboarding-border-100 h-[46px] w-full "
/>
</div>
)}
/>
<Button variant="primary" className="w-full" size="xl" type="submit" loading={isSubmitting}>
{isSubmitting ? "Verifying..." : "Next step"}
</Button>
</div> </div>
</form> </form>
); );

View File

@ -44,61 +44,59 @@ export const InstanceSetupEmailForm: FC<IInstanceSetupEmailForm> = (props) => {
}) })
.catch((err) => { .catch((err) => {
setToastAlert({ setToastAlert({
title: "Oops!",
type: "error", type: "error",
message: err?.error, title: "Error!",
message: err?.error ?? "Something went wrong. Please try again.",
}); });
}); });
return ( return (
<form onSubmit={handleSubmit(handleEmailFormSubmit)}> <form onSubmit={handleSubmit(handleEmailFormSubmit)}>
<div className="pb-2"> <h1 className="text-center text-2xl sm:text-2.5xl font-medium text-onboarding-text-100">
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-onboarding-text-100"> Let{"'"}s secure your instance
Lets secure your instance </h1>
</h1> <p className="text-center text-sm text-onboarding-text-200 mt-3">
<p className="text-center text-sm text-onboarding-text-200 mt-3"> Explore privacy options. Get AI features. Secure access.
Explore privacy options. Get AI features. Secure access. <br /> Takes 2 minutes. <br />
</p> Takes 2 minutes.
</p>
<div className="relative mt-10 w-full sm:w-[360px] mx-auto"> <div className="relative mt-5 w-full sm:w-96 mx-auto space-y-4">
<Controller <Controller
name="email" name="email"
control={control} control={control}
rules={{ rules={{
required: "Email address is required", required: "Email address is required",
validate: (value) => validate: (value) =>
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test( /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
value value
) || "Email address is not valid", ) || "Email address is not valid",
}} }}
render={({ field: { value, onChange } }) => ( render={({ field: { value, onChange } }) => (
<div className={`flex items-center relative rounded-md bg-onboarding-background-200`}> <div className={`flex items-center relative rounded-md bg-onboarding-background-200`}>
<Input <Input
id="email" id="email"
name="email" name="email"
type="email" type="email"
value={value} value={value}
onChange={onChange} onChange={onChange}
placeholder="orville.wright@firstflight.com" placeholder="orville.wright@firstflight.com"
className={`w-full h-[46px] placeholder:text-onboarding-text-400 border border-onboarding-border-100 pr-12`} className={`w-full h-[46px] placeholder:text-onboarding-text-400 border border-onboarding-border-100 pr-12`}
/>
{value.length > 0 && (
<XCircle
className="h-5 w-5 absolute stroke-custom-text-400 hover:cursor-pointer right-3"
onClick={() => setValue("email", "")}
/> />
{value.length > 0 && ( )}
<XCircle </div>
className="h-5 w-5 absolute stroke-custom-text-400 hover:cursor-pointer right-3" )}
onClick={() => setValue("email", "")} />
/> <p className="text-xs text-custom-text-200 pb-2">
)} Use your email address if you are the instance admin. <br /> Use your admins e-mail if you are not.
</div> </p>
)} <Button variant="primary" className="w-full" size="xl" type="submit" loading={isSubmitting}>
/> {isSubmitting ? "Sending code..." : "Send unique code"}
<p className="text-xs text-custom-text-400 mt-0 py-2"> </Button>
Use your email address if you are the instance admin. <br /> Use your admins e-mail if you are not.
</p>
<Button variant="primary" className="w-full mt-4" size="xl" type="submit" loading={isSubmitting}>
{isSubmitting ? "Sending code..." : "Send unique code"}
</Button>
</div>
</div> </div>
</form> </form>
); );

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import Link from "next/link";
import { useForm, Controller } from "react-hook-form"; import { useForm, Controller } from "react-hook-form";
// ui // ui
import { Input, Button } from "@plane/ui"; import { Input, Button } from "@plane/ui";
@ -43,14 +44,14 @@ export const InstanceSetupPasswordForm: React.FC<IInstanceSetupPasswordForm> = (
return ( return (
<form onSubmit={handleSubmit(handlePasswordSubmit)}> <form onSubmit={handleSubmit(handlePasswordSubmit)}>
<div className="pb-2"> <div className="pb-2">
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-onboarding-text-100"> <h1 className="text-center text-2xl sm:text-2.5xl font-medium text-onboarding-text-100">
Moving to the runway Moving to the runway
</h1> </h1>
<p className="text-center text-sm text-onboarding-text-200 mt-3"> <p className="text-center text-sm text-onboarding-text-200 mt-3">
{"Let's set a password so you can do away with codes."} Let{"'"}s set a password so you can do away with codes.
</p> </p>
<div className="relative mt-10 w-full sm:w-[360px] mx-auto"> <div className="relative mt-5 w-full sm:w-96 mx-auto space-y-4">
<Controller <Controller
control={control} control={control}
name="email" name="email"
@ -79,8 +80,7 @@ export const InstanceSetupPasswordForm: React.FC<IInstanceSetupPasswordForm> = (
</div> </div>
)} )}
/> />
<div>
<div className="mt-4">
<Controller <Controller
control={control} control={control}
name="password" name="password"
@ -106,13 +106,19 @@ export const InstanceSetupPasswordForm: React.FC<IInstanceSetupPasswordForm> = (
</div> </div>
)} )}
/> />
<p className="text-xs mt-3 text-onboarding-text-200 pb-2">
Whatever you choose now will be your account{"'"}s password
</p>
</div> </div>
<p className="text-xs mt-2 text-onboarding-text-200">
{"Whatever you choose now will be your account's password"}
</p>
<Button variant="primary" className="w-full mt-4" size="xl" type="submit" loading={isSubmitting}> <Button variant="primary" className="w-full mt-4" size="xl" type="submit" loading={isSubmitting}>
{isSubmitting ? "Submitting..." : "Next Step"} {isSubmitting ? "Submitting..." : "Next step"}
</Button> </Button>
<p className="text-xs text-onboarding-text-200">
When you click the button above, you agree with our{" "}
<Link href="https://plane.so/terms-and-conditions" target="_blank" rel="noopener noreferrer">
<span className="font-semibold underline">terms and conditions of service.</span>
</Link>
</p>
</div> </div>
</div> </div>
</form> </form>

View File

@ -21,13 +21,11 @@ export const InstanceSetupFormRoot = () => {
return ( return (
<> <>
{setupStep === EInstanceSetupSteps.DONE ? ( {setupStep === EInstanceSetupSteps.DONE ? (
<div> <InstanceSetupDone />
<InstanceSetupDone />
</div>
) : ( ) : (
<div className="h-full bg-onboarding-gradient-100 md:w-2/3 sm:w-4/5 px-4 pt-4 rounded-t-md mx-auto shadow-sm border-x border-t border-custom-border-200 "> <div className="h-full bg-onboarding-gradient-100 md:w-2/3 sm:w-4/5 px-4 pt-4 rounded-t-md mx-auto shadow-sm border-x border-t border-custom-border-200">
<div className={`px-7 sm:px-0 bg-onboarding-gradient-200 h-full pt-24 pb-56 rounded-t-md overflow-auto`}> <div className="bg-onboarding-gradient-200 h-full pt-24 pb-56 rounded-t-md overflow-auto">
<div className="sm:w-96 mx-auto flex flex-col divide-y divide-custom-border-200"> <div className="mx-auto flex flex-col">
{setupStep === EInstanceSetupSteps.EMAIL && ( {setupStep === EInstanceSetupSteps.EMAIL && (
<InstanceSetupEmailForm <InstanceSetupEmailForm
handleNextStep={(email) => { handleNextStep={(email) => {

View File

@ -24,7 +24,7 @@ export const InstanceSetupView = observer(() => {
return ( return (
<> <>
<div className={`bg-onboarding-gradient-100 h-full w-full`}> <div className="bg-onboarding-gradient-100 h-full w-full flex flex-col">
<div className="flex items-center justify-between sm:py-5 px-8 pb-4 sm:px-16 lg:px-28 "> <div className="flex items-center justify-between sm:py-5 px-8 pb-4 sm:px-16 lg:px-28 ">
<div className="flex gap-x-2 py-10 items-center"> <div className="flex gap-x-2 py-10 items-center">
<Image src={BluePlaneLogoWithoutText} height={30} width={30} alt="Plane Logo" className="mr-2" /> <Image src={BluePlaneLogoWithoutText} height={30} width={30} alt="Plane Logo" className="mr-2" />

View File

@ -54,7 +54,7 @@ export const InstanceAdminSidebarMenu = () => {
return ( return (
<Link key={index} href={item.href}> <Link key={index} href={item.href}>
<span className="block w-full"> <div>
<Tooltip tooltipContent={item.name} position="right" className="ml-2" disabled={!sidebarCollapsed}> <Tooltip tooltipContent={item.name} position="right" className="ml-2" disabled={!sidebarCollapsed}>
<div <div
className={`group flex w-full items-center gap-3 rounded-md px-3 py-2 outline-none ${ className={`group flex w-full items-center gap-3 rounded-md px-3 py-2 outline-none ${
@ -84,7 +84,7 @@ export const InstanceAdminSidebarMenu = () => {
)} )}
</div> </div>
</Tooltip> </Tooltip>
</span> </div>
</Link> </Link>
); );
})} })}

View File

@ -59,33 +59,31 @@ export const IssueAttachments = () => {
key={file.id} key={file.id}
className="flex h-[60px] items-center justify-between gap-1 rounded-md border-[2px] border-custom-border-200 bg-custom-background-100 px-4 py-2 text-sm" className="flex h-[60px] items-center justify-between gap-1 rounded-md border-[2px] border-custom-border-200 bg-custom-background-100 px-4 py-2 text-sm"
> >
<Link href={file.asset} target="_blank"> <Link href={file.asset} target="_blank" rel="noopener noreferrer">
<span> <div className="flex items-center gap-3">
<div className="flex items-center gap-3"> <div className="h-7 w-7">{getFileIcon(getFileExtension(file.asset))}</div>
<div className="h-7 w-7">{getFileIcon(getFileExtension(file.asset))}</div> <div className="flex flex-col gap-1">
<div className="flex flex-col gap-1"> <div className="flex items-center gap-2">
<div className="flex items-center gap-2"> <Tooltip tooltipContent={getFileName(file.attributes.name)}>
<Tooltip tooltipContent={getFileName(file.attributes.name)}> <span className="text-sm">{truncateText(`${getFileName(file.attributes.name)}`, 10)}</span>
<span className="text-sm">{truncateText(`${getFileName(file.attributes.name)}`, 10)}</span> </Tooltip>
</Tooltip> <Tooltip
<Tooltip tooltipContent={`${
tooltipContent={`${ people?.find((person) => person.member.id === file.updated_by)?.member.display_name ?? ""
people?.find((person) => person.member.id === file.updated_by)?.member.display_name ?? "" } uploaded on ${renderLongDateFormat(file.updated_at)}`}
} uploaded on ${renderLongDateFormat(file.updated_at)}`} >
> <span>
<span> <AlertCircle className="h-3 w-3" />
<AlertCircle className="h-3 w-3" /> </span>
</span> </Tooltip>
</Tooltip> </div>
</div>
<div className="flex items-center gap-3 text-xs text-custom-text-200"> <div className="flex items-center gap-3 text-xs text-custom-text-200">
<span>{getFileExtension(file.asset).toUpperCase()}</span> <span>{getFileExtension(file.asset).toUpperCase()}</span>
<span>{convertBytesToSize(file.attributes.size)}</span> <span>{convertBytesToSize(file.attributes.size)}</span>
</div>
</div> </div>
</div> </div>
</span> </div>
</Link> </Link>
<button <button

View File

@ -108,7 +108,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
<Link <Link
href={`/${workspaceSlug}/projects/${issueDetails.parent_detail?.project_detail.id}/issues/${issueDetails.parent}`} href={`/${workspaceSlug}/projects/${issueDetails.parent_detail?.project_detail.id}/issues/${issueDetails.parent}`}
> >
<a className="flex items-center gap-3"> <div className="flex items-center gap-3">
<div className="flex items-center gap-2.5"> <div className="flex items-center gap-2.5">
<span <span
className="block h-2 w-2 rounded-full" className="block h-2 w-2 rounded-full"
@ -123,7 +123,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
<span className="truncate text-custom-text-100"> <span className="truncate text-custom-text-100">
{issueDetails.parent_detail?.name.substring(0, 50)} {issueDetails.parent_detail?.name.substring(0, 50)}
</span> </span>
</a> </div>
</Link> </Link>
<CustomMenu ellipsis optionsClassName="px-1.5"> <CustomMenu ellipsis optionsClassName="px-1.5">

View File

@ -139,7 +139,7 @@ export const ModuleCardItem: React.FC<Props> = observer((props) => {
)} )}
<DeleteModuleModal data={module} isOpen={deleteModal} onClose={() => setDeleteModal(false)} /> <DeleteModuleModal data={module} isOpen={deleteModal} onClose={() => setDeleteModal(false)} />
<Link href={`/${workspaceSlug}/projects/${module.project}/modules/${module.id}`}> <Link href={`/${workspaceSlug}/projects/${module.project}/modules/${module.id}`}>
<span className="flex flex-col justify-between p-4 h-44 w-full min-w-[250px] text-sm rounded bg-custom-background-100 border border-custom-border-100 hover:shadow-md"> <div className="flex flex-col justify-between p-4 h-44 w-full min-w-[250px] text-sm rounded bg-custom-background-100 border border-custom-border-100 hover:shadow-md">
<div> <div>
<div className="flex items-center justify-between gap-2"> <div className="flex items-center justify-between gap-2">
<Tooltip tooltipContent={module.name} position="top"> <Tooltip tooltipContent={module.name} position="top">
@ -249,7 +249,7 @@ export const ModuleCardItem: React.FC<Props> = observer((props) => {
</div> </div>
</div> </div>
</div> </div>
</span> </div>
</Link> </Link>
</> </>
); );

View File

@ -128,7 +128,7 @@ export const ModuleListItem: React.FC<Props> = observer((props) => {
)} )}
<DeleteModuleModal data={module} isOpen={deleteModal} onClose={() => setDeleteModal(false)} /> <DeleteModuleModal data={module} isOpen={deleteModal} onClose={() => setDeleteModal(false)} />
<Link href={`/${workspaceSlug}/projects/${module.project}/modules/${module.id}`}> <Link href={`/${workspaceSlug}/projects/${module.project}/modules/${module.id}`}>
<span className="group flex items-center justify-between gap-5 px-5 py-6 h-16 w-full text-sm bg-custom-background-100 border-b border-custom-border-100 hover:bg-custom-background-90"> <div className="group flex items-center justify-between gap-5 px-5 py-6 h-16 w-full text-sm bg-custom-background-100 border-b border-custom-border-100 hover:bg-custom-background-90">
<div className="flex items-center gap-3 w-full truncate"> <div className="flex items-center gap-3 w-full truncate">
<div className="flex items-center gap-4 truncate"> <div className="flex items-center gap-4 truncate">
<span className="flex-shrink-0"> <span className="flex-shrink-0">
@ -225,7 +225,7 @@ export const ModuleListItem: React.FC<Props> = observer((props) => {
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
</CustomMenu> </CustomMenu>
</div> </div>
</span> </div>
</Link> </Link>
</> </>
); );

View File

@ -13,7 +13,7 @@ import { SignInRoot } from "components/account";
import { Loader, Spinner } from "@plane/ui"; import { Loader, Spinner } from "@plane/ui";
// images // images
import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png"; import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png";
import signInIssues from "public/onboarding/onboarding-issues.svg"; import latestFeatures from "public/onboarding/onboarding-pages.svg";
// types // types
import { IUser, IUserSettings } from "types"; import { IUser, IUserSettings } from "types";
@ -108,24 +108,21 @@ export const SignInView = observer(() => {
<Lightbulb className="h-7 w-7 mr-2 mx-3" /> <Lightbulb className="h-7 w-7 mr-2 mx-3" />
<p className="text-sm text-left text-onboarding-text-100"> <p className="text-sm text-left text-onboarding-text-100">
Pages gets a facelift! Write anything and use Galileo to help you start.{" "} Pages gets a facelift! Write anything and use Galileo to help you start.{" "}
<Link <Link href="https://plane.so/changelog" target="_blank" rel="noopener noreferrer">
href="https://plane.so/changelog" <span className="font-medium text-sm underline hover:cursor-pointer">Learn more</span>
target="_blank"
rel="noopener noreferrer"
className="font-medium text-sm underline hover:cursor-pointer"
>
Learn more
</Link> </Link>
</p> </p>
</div> </div>
<div className="flex justify-center border border-onboarding-border-200 sm:w-96 sm:h-52 object-cover mt-8 mx-auto rounded-md bg-onboarding-background-100 "> <div className="border border-onboarding-border-200 sm:w-96 sm:h-52 object-cover mt-8 mx-auto rounded-md bg-onboarding-background-100 overflow-hidden">
<Image <div className="h-[90%]">
src={signInIssues} <Image
alt="Plane Issues" src={latestFeatures}
className={`flex object-cover rounded-md ${ alt="Plane Issues"
resolvedTheme === "dark" ? "bg-onboarding-background-100" : "bg-custom-primary-70" className={`rounded-md h-full ml-8 -mt-2 ${
} `} resolvedTheme === "dark" ? "bg-onboarding-background-100" : "bg-custom-primary-70"
/> } `}
/>
</div>
</div> </div>
</> </>
)} )}

View File

@ -157,145 +157,143 @@ export const PagesListItem: FC<IPagesListItem> = observer((props) => {
<DeletePageModal isOpen={deletePageModal} onClose={() => setDeletePageModal(false)} data={page} /> <DeletePageModal isOpen={deletePageModal} onClose={() => setDeletePageModal(false)} data={page} />
<li> <li>
<Link href={`/${workspaceSlug}/projects/${projectId}/pages/${page.id}`}> <Link href={`/${workspaceSlug}/projects/${projectId}/pages/${page.id}`}>
<span> <div className="relative rounded p-4 text-custom-text-200 hover:bg-custom-background-80">
<div className="relative rounded p-4 text-custom-text-200 hover:bg-custom-background-80"> <div className="flex items-center justify-between">
<div className="flex items-center justify-between"> <div className="flex overflow-hidden items-center gap-2">
<div className="flex overflow-hidden items-center gap-2"> <FileText className="h-4 w-4 shrink-0" />
<FileText className="h-4 w-4 shrink-0" /> <p className="mr-2 truncate text-sm text-custom-text-100">{page.name}</p>
<p className="mr-2 truncate text-sm text-custom-text-100">{page.name}</p> {page.label_details.length > 0 &&
{page.label_details.length > 0 && page.label_details.map((label) => (
page.label_details.map((label) => ( <div
<div key={label.id}
key={label.id} className="group flex items-center gap-1 rounded-2xl border border-custom-border-200 px-2 py-0.5 text-xs"
className="group flex items-center gap-1 rounded-2xl border border-custom-border-200 px-2 py-0.5 text-xs" style={{
backgroundColor: `${label?.color}20`,
}}
>
<span
className="h-1.5 w-1.5 flex-shrink-0 rounded-full"
style={{ style={{
backgroundColor: `${label?.color}20`, backgroundColor: label?.color,
}} }}
> />
<span {label.name}
className="h-1.5 w-1.5 flex-shrink-0 rounded-full" </div>
style={{ ))}
backgroundColor: label?.color, </div>
}} <div className="flex items-center gap-2.5">
/> {page.archived_at ? (
{label.name}
</div>
))}
</div>
<div className="flex items-center gap-2.5">
{page.archived_at ? (
<Tooltip
tooltipContent={`Archived at ${render24HourFormatTime(page.archived_at)} on ${renderShortDate(
page.archived_at
)}`}
>
<p className="text-sm text-custom-text-200">{render24HourFormatTime(page.archived_at)}</p>
</Tooltip>
) : (
<Tooltip
tooltipContent={`Last updated at ${render24HourFormatTime(page.updated_at)} on ${renderShortDate(
page.updated_at
)}`}
>
<p className="text-sm text-custom-text-200">{render24HourFormatTime(page.updated_at)}</p>
</Tooltip>
)}
{!page.archived_at && userCanEdit && (
<Tooltip tooltipContent={`${page.is_favorite ? "Remove from favorites" : "Mark as favorite"}`}>
{page.is_favorite ? (
<button type="button" onClick={handleRemoveFromFavorites}>
<Star className="h-3.5 w-3.5 text-orange-400 fill-orange-400" />
</button>
) : (
<button type="button" onClick={handleAddToFavorites}>
<Star className="h-3.5 w-3.5" />
</button>
)}
</Tooltip>
)}
{!page.archived_at && userCanEdit && (
<Tooltip
tooltipContent={`${
page.access
? "This page is only visible to you"
: "This page can be viewed by anyone in the project"
}`}
>
{page.access ? (
<button type="button" onClick={handleMakePublic}>
<Lock className="h-3.5 w-3.5" />
</button>
) : (
<button type="button" onClick={handleMakePrivate}>
<Globe2 className="h-3.5 w-3.5" />
</button>
)}
</Tooltip>
)}
<Tooltip <Tooltip
position="top-right" tooltipContent={`Archived at ${render24HourFormatTime(page.archived_at)} on ${renderShortDate(
tooltipContent={`Created by ${ page.archived_at
projectMembers?.find((projectMember) => projectMember.member.id === page.created_by)?.member )}`}
.display_name ?? ""
} on ${renderLongDateFormat(`${page.created_at}`)}`}
> >
<AlertCircle className="h-3.5 w-3.5" /> <p className="text-sm text-custom-text-200">{render24HourFormatTime(page.archived_at)}</p>
</Tooltip> </Tooltip>
{page.archived_at ? ( ) : (
<CustomMenu width="auto" placement="bottom-end" className="!-m-1" verticalEllipsis> <Tooltip
{userCanEdit && ( tooltipContent={`Last updated at ${render24HourFormatTime(page.updated_at)} on ${renderShortDate(
<> page.updated_at
<CustomMenu.MenuItem onClick={handleRestorePage}> )}`}
<div className="flex items-center gap-2"> >
<ArchiveRestoreIcon className="h-3 w-3" /> <p className="text-sm text-custom-text-200">{render24HourFormatTime(page.updated_at)}</p>
<span>Restore page</span> </Tooltip>
</div> )}
</CustomMenu.MenuItem> {!page.archived_at && userCanEdit && (
<CustomMenu.MenuItem onClick={handleDeletePage}> <Tooltip tooltipContent={`${page.is_favorite ? "Remove from favorites" : "Mark as favorite"}`}>
<div className="flex items-center gap-2"> {page.is_favorite ? (
<Trash2 className="h-3 w-3" /> <button type="button" onClick={handleRemoveFromFavorites}>
<span>Delete page</span> <Star className="h-3.5 w-3.5 text-orange-400 fill-orange-400" />
</div> </button>
</CustomMenu.MenuItem> ) : (
</> <button type="button" onClick={handleAddToFavorites}>
)} <Star className="h-3.5 w-3.5" />
<CustomMenu.MenuItem onClick={handleCopyUrl}> </button>
<div className="flex items-center gap-2"> )}
<LinkIcon className="h-3 w-3" /> </Tooltip>
<span>Copy page link</span> )}
</div> {!page.archived_at && userCanEdit && (
</CustomMenu.MenuItem> <Tooltip
</CustomMenu> tooltipContent={`${
) : ( page.access
<CustomMenu width="auto" placement="bottom-end" className="!-m-1" verticalEllipsis> ? "This page is only visible to you"
{userCanEdit && ( : "This page can be viewed by anyone in the project"
<> }`}
<CustomMenu.MenuItem onClick={handleEditPage}> >
<div className="flex items-center gap-2"> {page.access ? (
<Pencil className="h-3 w-3" /> <button type="button" onClick={handleMakePublic}>
<span>Edit page</span> <Lock className="h-3.5 w-3.5" />
</div> </button>
</CustomMenu.MenuItem> ) : (
<CustomMenu.MenuItem onClick={handleArchivePage}> <button type="button" onClick={handleMakePrivate}>
<div className="flex items-center gap-2"> <Globe2 className="h-3.5 w-3.5" />
<Archive className="h-3 w-3" /> </button>
<span>Archive page</span> )}
</div> </Tooltip>
</CustomMenu.MenuItem> )}
</> <Tooltip
)} position="top-right"
<CustomMenu.MenuItem onClick={handleCopyUrl}> tooltipContent={`Created by ${
<div className="flex items-center gap-2"> projectMembers?.find((projectMember) => projectMember.member.id === page.created_by)?.member
<LinkIcon className="h-3 w-3" /> .display_name ?? ""
<span>Copy page link</span> } on ${renderLongDateFormat(`${page.created_at}`)}`}
</div> >
</CustomMenu.MenuItem> <AlertCircle className="h-3.5 w-3.5" />
</CustomMenu> </Tooltip>
)} {page.archived_at ? (
</div> <CustomMenu width="auto" placement="bottom-end" className="!-m-1" verticalEllipsis>
{userCanEdit && (
<>
<CustomMenu.MenuItem onClick={handleRestorePage}>
<div className="flex items-center gap-2">
<ArchiveRestoreIcon className="h-3 w-3" />
<span>Restore page</span>
</div>
</CustomMenu.MenuItem>
<CustomMenu.MenuItem onClick={handleDeletePage}>
<div className="flex items-center gap-2">
<Trash2 className="h-3 w-3" />
<span>Delete page</span>
</div>
</CustomMenu.MenuItem>
</>
)}
<CustomMenu.MenuItem onClick={handleCopyUrl}>
<div className="flex items-center gap-2">
<LinkIcon className="h-3 w-3" />
<span>Copy page link</span>
</div>
</CustomMenu.MenuItem>
</CustomMenu>
) : (
<CustomMenu width="auto" placement="bottom-end" className="!-m-1" verticalEllipsis>
{userCanEdit && (
<>
<CustomMenu.MenuItem onClick={handleEditPage}>
<div className="flex items-center gap-2">
<Pencil className="h-3 w-3" />
<span>Edit page</span>
</div>
</CustomMenu.MenuItem>
<CustomMenu.MenuItem onClick={handleArchivePage}>
<div className="flex items-center gap-2">
<Archive className="h-3 w-3" />
<span>Archive page</span>
</div>
</CustomMenu.MenuItem>
</>
)}
<CustomMenu.MenuItem onClick={handleCopyUrl}>
<div className="flex items-center gap-2">
<LinkIcon className="h-3 w-3" />
<span>Copy page link</span>
</div>
</CustomMenu.MenuItem>
</CustomMenu>
)}
</div> </div>
</div> </div>
</span> </div>
</Link> </Link>
</li> </li>
</> </>

View File

@ -57,7 +57,7 @@ export const ProjectViewListItem: React.FC<Props> = observer((props) => {
<DeleteProjectViewModal data={view} isOpen={deleteViewModal} onClose={() => setDeleteViewModal(false)} /> <DeleteProjectViewModal data={view} isOpen={deleteViewModal} onClose={() => setDeleteViewModal(false)} />
<div className="group hover:bg-custom-background-90 border-b border-custom-border-200"> <div className="group hover:bg-custom-background-90 border-b border-custom-border-200">
<Link href={`/${workspaceSlug}/projects/${projectId}/views/${view.id}`}> <Link href={`/${workspaceSlug}/projects/${projectId}/views/${view.id}`}>
<span className="flex items-center justify-between relative rounded p-4 w-full"> <div className="flex items-center justify-between relative rounded p-4 w-full">
<div className="flex items-center justify-between w-full"> <div className="flex items-center justify-between w-full">
<div className="flex items-center gap-4 overflow-hidden"> <div className="flex items-center gap-4 overflow-hidden">
<div className="grid place-items-center flex-shrink-0 h-10 w-10 rounded bg-custom-background-90 group-hover:bg-custom-background-100"> <div className="grid place-items-center flex-shrink-0 h-10 w-10 rounded bg-custom-background-90 group-hover:bg-custom-background-100">
@ -128,7 +128,7 @@ export const ProjectViewListItem: React.FC<Props> = observer((props) => {
</div> </div>
</div> </div>
</div> </div>
</span> </div>
</Link> </Link>
</div> </div>
</> </>

View File

@ -18,7 +18,7 @@ export const GlobalDefaultViewListItem: React.FC<Props> = observer((props) => {
return ( return (
<div className="group hover:bg-custom-background-90 border-b border-custom-border-200"> <div className="group hover:bg-custom-background-90 border-b border-custom-border-200">
<Link href={`/${workspaceSlug}/workspace-views/${view.key}`}> <Link href={`/${workspaceSlug}/workspace-views/${view.key}`}>
<span className="flex items-center justify-between relative rounded px-5 py-4 w-full"> <div className="flex items-center justify-between relative rounded px-5 py-4 w-full">
<div className="flex items-center justify-between w-full"> <div className="flex items-center justify-between w-full">
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">
<div className="grid place-items-center h-10 w-10 rounded bg-custom-background-90 group-hover:bg-custom-background-100"> <div className="grid place-items-center h-10 w-10 rounded bg-custom-background-90 group-hover:bg-custom-background-100">
@ -29,7 +29,7 @@ export const GlobalDefaultViewListItem: React.FC<Props> = observer((props) => {
</div> </div>
</div> </div>
</div> </div>
</span> </div>
</Link> </Link>
</div> </div>
); );

View File

@ -32,7 +32,7 @@ export const GlobalViewListItem: React.FC<Props> = observer((props) => {
<DeleteGlobalViewModal data={view} isOpen={deleteViewModal} onClose={() => setDeleteViewModal(false)} /> <DeleteGlobalViewModal data={view} isOpen={deleteViewModal} onClose={() => setDeleteViewModal(false)} />
<div className="group hover:bg-custom-background-90 border-b border-custom-border-200"> <div className="group hover:bg-custom-background-90 border-b border-custom-border-200">
<Link href={`/${workspaceSlug}/workspace-views/${view.id}`}> <Link href={`/${workspaceSlug}/workspace-views/${view.id}`}>
<span className="flex items-center justify-between relative rounded p-4 w-full"> <div className="flex items-center justify-between relative rounded p-4 w-full">
<div className="flex items-center justify-between w-full"> <div className="flex items-center justify-between w-full">
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">
<div className="grid place-items-center h-10 w-10 rounded bg-custom-background-90 group-hover:bg-custom-background-100"> <div className="grid place-items-center h-10 w-10 rounded bg-custom-background-90 group-hover:bg-custom-background-100">
@ -77,7 +77,7 @@ export const GlobalViewListItem: React.FC<Props> = observer((props) => {
</div> </div>
</div> </div>
</div> </div>
</span> </div>
</Link> </Link>
</div> </div>
</> </>

View File

@ -1,4 +1,5 @@
import { FC, ReactNode } from "react"; import { FC, ReactNode } from "react";
import { observer } from "mobx-react-lite";
// layouts // layouts
import { AdminAuthWrapper, UserAuthWrapper } from "layouts/auth-layout"; import { AdminAuthWrapper, UserAuthWrapper } from "layouts/auth-layout";
// components // components
@ -12,20 +13,14 @@ export interface IInstanceAdminLayout {
children: ReactNode; children: ReactNode;
} }
export const InstanceAdminLayout: FC<IInstanceAdminLayout> = (props) => { export const InstanceAdminLayout: FC<IInstanceAdminLayout> = observer((props) => {
const { children } = props; const { children } = props;
// store // store
const { const {
instance: { instance }, instance: { instance },
user: { currentUser },
} = useMobxStore(); } = useMobxStore();
// fetch
console.log("instance", instance); if (instance?.is_setup_done === false) return <InstanceSetupView />;
if (instance?.is_setup_done === false) {
return <InstanceSetupView />;
}
return ( return (
<> <>
@ -46,4 +41,4 @@ export const InstanceAdminLayout: FC<IInstanceAdminLayout> = (props) => {
</UserAuthWrapper> </UserAuthWrapper>
</> </>
); );
}; });

View File

@ -21,7 +21,6 @@ export const UserAuthWrapper: FC<IUserAuthWrapper> = observer((props) => {
fetchCurrentUser, fetchCurrentUser,
fetchCurrentUserInstanceAdminStatus, fetchCurrentUserInstanceAdminStatus,
fetchCurrentUserSettings, fetchCurrentUserSettings,
}, },
workspace: { fetchWorkspaces }, workspace: { fetchWorkspaces },
} = useMobxStore(); } = useMobxStore();

View File

@ -24,7 +24,9 @@ const InstanceLayout: FC<Props> = observer(({ children }) => {
const router = useRouter(); const router = useRouter();
const isGodMode = router.pathname.includes("god-mode"); const isGodMode = router.pathname.includes("god-mode");
useSWR("INSTANCE_INFO", () => fetchInstanceInfo()); useSWR("INSTANCE_INFO", () => fetchInstanceInfo(), {
revalidateOnFocus: false,
});
useEffect(() => { useEffect(() => {
if (instance?.is_activated === false) { if (instance?.is_activated === false) {

View File

@ -102,18 +102,19 @@ export const ProfileLayoutSidebar = observer(() => {
} ${sidebarCollapsed ? "left-0" : "-left-full md:left-0"}`} } ${sidebarCollapsed ? "left-0" : "-left-full md:left-0"}`}
> >
<div className="h-full w-full flex flex-col gap-y-4"> <div className="h-full w-full flex flex-col gap-y-4">
<Link <Link href={`/${redirectWorkspaceSlug}`}>
href={`/${redirectWorkspaceSlug}`} <div
className={`flex-shrink-0 flex items-center gap-2 px-4 pt-4 truncate ${ className={`flex-shrink-0 flex items-center gap-2 px-4 pt-4 truncate ${
sidebarCollapsed ? "justify-center" : "" sidebarCollapsed ? "justify-center" : ""
}`} }`}
> >
<span className="flex-shrink-0 grid place-items-center h-5 w-5"> <span className="flex-shrink-0 grid place-items-center h-5 w-5">
<ChevronLeft className="h-5 w-5" strokeWidth={1} /> <ChevronLeft className="h-5 w-5" strokeWidth={1} />
</span> </span>
{!sidebarCollapsed && ( {!sidebarCollapsed && (
<h4 className="text-custom-text-200 font-semibold text-lg truncate">Profile settings</h4> <h4 className="text-custom-text-200 font-semibold text-lg truncate">Profile settings</h4>
)} )}
</div>
</Link> </Link>
<div className="flex-shrink-0 flex flex-col overflow-x-hidden px-4"> <div className="flex-shrink-0 flex flex-col overflow-x-hidden px-4">
{!sidebarCollapsed && ( {!sidebarCollapsed && (

View File

@ -50,17 +50,15 @@ export const ProjectSettingsSidebar = () => {
<div className="flex flex-col gap-1 w-full"> <div className="flex flex-col gap-1 w-full">
{projectLinks.map((link) => ( {projectLinks.map((link) => (
<Link key={link.href} href={link.href}> <Link key={link.href} href={link.href}>
<span> <div
<div className={`px-4 py-2 text-sm font-medium rounded-md ${
className={`px-4 py-2 text-sm font-medium rounded-md ${ (link.label === "Import" ? router.asPath.includes(link.href) : router.asPath === link.href)
(link.label === "Import" ? router.asPath.includes(link.href) : router.asPath === link.href) ? "bg-custom-primary-100/10 text-custom-primary-100"
? "bg-custom-primary-100/10 text-custom-primary-100" : "text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80 focus:bg-custom-sidebar-background-80"
: "text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80 focus:bg-custom-sidebar-background-80" }`}
}`} >
> {link.label}
{link.label} </div>
</div>
</span>
</Link> </Link>
))} ))}
</div> </div>

View File

@ -1,4 +1,4 @@
import { ReactElement } from "react"; import { ReactElement, useCallback } from "react";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
@ -15,11 +15,14 @@ import DefaultLayout from "layouts/default-layout";
import { Button, Input } from "@plane/ui"; import { Button, Input } from "@plane/ui";
// images // images
import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png"; import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text.png";
import signInIssues from "public/onboarding/onboarding-issues.svg"; import latestFeatures from "public/onboarding/onboarding-pages.svg";
// helpers // helpers
import { checkEmailValidity } from "helpers/string.helper"; import { checkEmailValidity } from "helpers/string.helper";
// type // type
import { NextPageWithLayout } from "types/app"; import { NextPageWithLayout } from "types/app";
import { useMobxStore } from "lib/mobx/store-provider";
// types
import { IUser, IUserSettings } from "types";
type TResetPasswordFormValues = { type TResetPasswordFormValues = {
email: string; email: string;
@ -42,6 +45,10 @@ const HomePage: NextPageWithLayout = () => {
const { resolvedTheme } = useTheme(); const { resolvedTheme } = useTheme();
// toast // toast
const { setToastAlert } = useToast(); const { setToastAlert } = useToast();
// mobx store
const {
user: { fetchCurrentUser, fetchCurrentUserSettings },
} = useMobxStore();
// form info // form info
const { const {
control, control,
@ -54,6 +61,31 @@ const HomePage: NextPageWithLayout = () => {
}, },
}); });
const handleSignInRedirection = useCallback(
async (user: IUser) => {
// if the user is not onboarded, redirect them to the onboarding page
if (!user.is_onboarded) {
router.push("/onboarding");
return;
}
// if the user is onboarded, fetch their last workspace details
await fetchCurrentUserSettings().then((userSettings: IUserSettings) => {
const workspaceSlug =
userSettings?.workspace?.last_workspace_slug || userSettings?.workspace?.fallback_workspace_slug;
if (workspaceSlug) router.push(`/${workspaceSlug}`);
else router.push("/profile");
});
},
[fetchCurrentUserSettings, router]
);
const mutateUserInfo = useCallback(async () => {
await fetchCurrentUser().then(async (user) => {
await handleSignInRedirection(user);
});
}, [fetchCurrentUser, handleSignInRedirection]);
const handleResetPassword = async (formData: TResetPasswordFormValues) => { const handleResetPassword = async (formData: TResetPasswordFormValues) => {
if (!uidb64 || !token || !email) return; if (!uidb64 || !token || !email) return;
@ -61,13 +93,16 @@ const HomePage: NextPageWithLayout = () => {
new_password: formData.password, new_password: formData.password,
}; };
await authService.resetPassword(uidb64.toString(), token.toString(), payload).catch((err) => await authService
setToastAlert({ .resetPassword(uidb64.toString(), token.toString(), payload)
type: "error", .then(() => mutateUserInfo())
title: "Error!", .catch((err) =>
message: err?.error ?? "Something went wrong. Please try again.", setToastAlert({
}) type: "error",
); title: "Error!",
message: err?.error ?? "Something went wrong. Please try again.",
})
);
}; };
return ( return (
@ -82,7 +117,7 @@ const HomePage: NextPageWithLayout = () => {
<div className="h-full bg-onboarding-gradient-100 md:w-2/3 sm:w-4/5 px-4 pt-4 rounded-t-md mx-auto shadow-sm border-x border-t border-custom-border-200 "> <div className="h-full bg-onboarding-gradient-100 md:w-2/3 sm:w-4/5 px-4 pt-4 rounded-t-md mx-auto shadow-sm border-x border-t border-custom-border-200 ">
<div className="px-7 sm:px-0 bg-onboarding-gradient-200 h-full pt-24 pb-56 rounded-t-md overflow-auto"> <div className="px-7 sm:px-0 bg-onboarding-gradient-200 h-full pt-24 pb-56 rounded-t-md overflow-auto">
<div className="sm:w-96 mx-auto flex flex-col divide-y divide-custom-border-200"> <div className="sm:w-96 mx-auto flex flex-col divide-y divide-custom-border-200">
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-onboarding-text-100"> <h1 className="text-center text-2xl sm:text-2.5xl font-medium text-onboarding-text-100">
Let{"'"}s get a new password Let{"'"}s get a new password
</h1> </h1>
<form onSubmit={handleSubmit(handleResetPassword)} className="mt-11 sm:w-96 mx-auto space-y-4"> <form onSubmit={handleSubmit(handleResetPassword)} className="mt-11 sm:w-96 mx-auto space-y-4">
@ -123,6 +158,7 @@ const HomePage: NextPageWithLayout = () => {
hasError={Boolean(errors.password)} hasError={Boolean(errors.password)}
placeholder="Choose password" placeholder="Choose password"
className="w-full h-[46px] placeholder:text-onboarding-text-400 border border-onboarding-border-100 pr-12" className="w-full h-[46px] placeholder:text-onboarding-text-400 border border-onboarding-border-100 pr-12"
minLength={8}
/> />
)} )}
/> />
@ -142,13 +178,8 @@ const HomePage: NextPageWithLayout = () => {
</Button> </Button>
<p className="text-xs text-onboarding-text-200"> <p className="text-xs text-onboarding-text-200">
When you click the button above, you agree with our{" "} When you click the button above, you agree with our{" "}
<Link <Link href="https://plane.so/terms-and-conditions" target="_blank" rel="noopener noreferrer">
href="https://plane.so/terms-and-conditions" <span className="font-semibold underline">terms and conditions of service.</span>
target="_blank"
rel="noopener noreferrer"
className="font-semibold underline"
>
terms and conditions of service.
</Link> </Link>
</p> </p>
</form> </form>
@ -157,25 +188,21 @@ const HomePage: NextPageWithLayout = () => {
<Lightbulb className="h-7 w-7 mr-2 mx-3" /> <Lightbulb className="h-7 w-7 mr-2 mx-3" />
<p className="text-sm text-left text-onboarding-text-100"> <p className="text-sm text-left text-onboarding-text-100">
Try the latest features, like Tiptap editor, to write compelling responses.{" "} Try the latest features, like Tiptap editor, to write compelling responses.{" "}
<Link href="https://plane.so/changelog"> <Link href="https://plane.so/changelog" target="_blank" rel="noopener noreferrer">
<a <span className="font-medium text-sm underline hover:cursor-pointer">See new features</span>
target="_blank"
rel="noopener noreferrer"
className="font-medium text-sm underline hover:cursor-pointer"
>
See new features
</a>
</Link> </Link>
</p> </p>
</div> </div>
<div className="flex justify-center border border-onboarding-border-200 sm:w-96 sm:h-52 object-cover mt-8 mx-auto rounded-md bg-onboarding-background-100 "> <div className="border border-onboarding-border-200 sm:w-96 sm:h-52 object-cover mt-8 mx-auto rounded-md bg-onboarding-background-100 overflow-hidden">
<Image <div className="h-[90%]">
src={signInIssues} <Image
alt="Plane Issues" src={latestFeatures}
className={`flex object-cover rounded-md ${ alt="Plane Issues"
resolvedTheme === "dark" ? "bg-onboarding-background-100" : "bg-custom-primary-70" className={`rounded-md h-full ml-8 -mt-2 ${
} `} resolvedTheme === "dark" ? "bg-onboarding-background-100" : "bg-custom-primary-70"
/> } `}
/>
</div>
</div> </div>
</div> </div>
</div> </div>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 527 KiB

View File

@ -55,7 +55,7 @@ export class AuthService extends APIService {
new_password: string; new_password: string;
} }
): Promise<ILoginTokenResponse> { ): Promise<ILoginTokenResponse> {
return this.post(`/api/reset-password/${uidb64}/${token}/`, data) return this.post(`/api/reset-password/${uidb64}/${token}/`, data, { headers: {} })
.then((response) => { .then((response) => {
if (response?.status === 200) { if (response?.status === 200) {
this.setAccessToken(response?.data?.access_token); this.setAccessToken(response?.data?.access_token);

View File

@ -71,7 +71,7 @@ export class InstanceStore implements IInstanceStore {
} }
/** /**
* fetch instace info from API * fetch instance info from API
*/ */
fetchInstanceInfo = async () => { fetchInstanceInfo = async () => {
try { try {