feat: converting space app to use nextjs app dir (#4451)

* feat: changemod space

* fix: space app dir fixes

* fix: build errors
This commit is contained in:
sriram veeraghanta 2024-05-14 14:26:54 +05:30 committed by GitHub
parent 087d54a261
commit febf19ccc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
98 changed files with 1038 additions and 1551 deletions

View file

@ -1,3 +1,5 @@
"use client";
import React from "react";
import { Controller, useForm } from "react-hook-form";
// icons

View file

@ -1,3 +1,4 @@
"use client";
import { Fragment, useState } from "react";
import { usePopper } from "react-popper";
import { X } from "lucide-react";

View file

@ -1,7 +1,9 @@
"use client";
import React, { useEffect, useMemo, useState } from "react";
// icons
import Link from "next/link";
import { useRouter } from "next/router";
import { useParams } from "next/navigation";
import { Eye, EyeOff, XCircle } from "lucide-react";
// ui
import { Button, Input, Spinner } from "@plane/ui";
@ -12,7 +14,7 @@ import { API_BASE_URL } from "@/helpers/common.helper";
import { getPasswordStrength } from "@/helpers/password.helper";
// hooks
import { useInstance } from "@/hooks/store";
import { AuthService } from "@/services/authentication.service";
import { AuthService } from "@/services/auth.service";
type Props = {
email: string;
@ -43,12 +45,11 @@ export const PasswordForm: React.FC<Props> = (props) => {
const [isPasswordInputFocused, setIsPasswordInputFocused] = useState(false);
const [isSubmitting, setIsSubmitting] = useState(false);
// hooks
const { instance } = useInstance();
const { data: instance, config: instanceConfig } = useInstance();
// router
const router = useRouter();
const { next_path } = router.query;
const { next_path } = useParams<any>();
// derived values
const isSmtpConfigured = instance?.config?.is_smtp_configured;
const isSmtpConfigured = instanceConfig?.is_smtp_configured;
const handleFormChange = (key: keyof TPasswordFormValues, value: string) =>
setPasswordFormData((prev) => ({ ...prev, [key]: value }));

View file

@ -1,3 +1,5 @@
"use client";
import React, { useState } from "react";
import { observer } from "mobx-react-lite";
// components
@ -7,7 +9,7 @@ import { EmailForm, UniqueCodeForm, PasswordForm, OAuthOptions, TermsAndConditio
import { useInstance } from "@/hooks/store";
import useToast from "@/hooks/use-toast";
// services
import { AuthService } from "@/services/authentication.service";
import { AuthService } from "@/services/auth.service";
export enum EAuthSteps {
EMAIL = "EMAIL",
@ -60,9 +62,9 @@ export const AuthRoot = observer(() => {
const [authStep, setAuthStep] = useState<EAuthSteps>(EAuthSteps.EMAIL);
const [email, setEmail] = useState("");
// hooks
const { instance } = useInstance();
const { config: instanceConfig } = useInstance();
// derived values
const isSmtpConfigured = instance?.config?.is_smtp_configured;
const isSmtpConfigured = instanceConfig?.is_smtp_configured;
const { header, subHeader } = getHeaderSubHeader(authMode);
@ -112,8 +114,8 @@ export const AuthRoot = observer(() => {
);
};
const isOAuthEnabled =
instance?.config && (instance?.config?.is_google_enabled || instance?.config?.is_github_enabled);
const isOAuthEnabled = instanceConfig && (instanceConfig?.is_google_enabled || instanceConfig?.is_github_enabled);
return (
<div className="relative flex flex-col space-y-6">
<div className="space-y-1 text-center">
@ -149,7 +151,7 @@ export const AuthRoot = observer(() => {
)}
</>
)}
{isOAuthEnabled && <OAuthOptions />}
{isOAuthEnabled !== undefined && <OAuthOptions />}
<TermsAndConditions mode={authMode} />
</div>
);

View file

@ -1,5 +1,7 @@
"use client";
import React, { useEffect, useState } from "react";
import { useRouter } from "next/router";
import { useParams } from "next/navigation";
// icons
import { CircleCheck, XCircle } from "lucide-react";
// ui
@ -10,7 +12,7 @@ import { API_BASE_URL } from "@/helpers/common.helper";
import useTimer from "@/hooks/use-timer";
import useToast from "@/hooks/use-toast";
// services
import { AuthService } from "@/services/authentication.service";
import { AuthService } from "@/services/auth.service";
// types
import { IEmailCheckData } from "@/types/auth";
import { EAuthModes } from "./root";
@ -43,8 +45,7 @@ export const UniqueCodeForm: React.FC<Props> = (props) => {
const [csrfToken, setCsrfToken] = useState<string | undefined>(undefined);
const [isSubmitting, setIsSubmitting] = useState(false);
// router
const router = useRouter();
const { next_path } = router.query;
const { next_path } = useParams<any>();
// toast alert
const { setToastAlert } = useToast();
// timer

View file

@ -1,3 +1,5 @@
"use client";
import { FC } from "react";
import Image from "next/image";
import { useTheme } from "next-themes";

View file

@ -1,3 +1,5 @@
"use client";
import { FC } from "react";
import Image from "next/image";
import { useTheme } from "next-themes";

View file

@ -1,3 +1,5 @@
"use client";
import { observer } from "mobx-react-lite";
// components
import { GithubOAuthButton, GoogleOAuthButton } from "@/components/accounts";
@ -6,7 +8,7 @@ import { useInstance } from "@/hooks/store";
export const OAuthOptions: React.FC = observer(() => {
// hooks
const { instance } = useInstance();
const { config: instanceConfig } = useInstance();
return (
<>
@ -16,12 +18,12 @@ export const OAuthOptions: React.FC = observer(() => {
<hr className="w-full border-onboarding-border-100" />
</div>
<div className={`mx-auto mt-7 grid gap-4 overflow-hidden sm:w-96`}>
{instance?.config?.is_google_enabled && (
{instanceConfig?.is_google_enabled && (
<div className="flex h-[42px] items-center !overflow-hidden">
<GoogleOAuthButton text="SignIn with Google" />
</div>
)}
{instance?.config?.is_github_enabled && <GithubOAuthButton text="SignIn with Github" />}
{instanceConfig?.is_github_enabled && <GithubOAuthButton text="SignIn with Github" />}
</div>
</>
);

View file

@ -1,3 +1,5 @@
"use client";
import React, { useMemo, useState } from "react";
import { observer } from "mobx-react-lite";
import { Controller, useForm } from "react-hook-form";
@ -8,7 +10,7 @@ import { Button, Input, Spinner, TOAST_TYPE, setToast } from "@plane/ui";
// components
import { UserImageUploadModal } from "@/components/accounts";
// hooks
import { useMobxStore } from "@/hooks/store";
import { useUser } from "@/hooks/store";
// services
import fileService from "@/services/file.service";
@ -35,9 +37,7 @@ export const OnBoardingForm: React.FC<Props> = observer((props) => {
const [isRemoving, setIsRemoving] = useState(false);
const [isImageUploadModalOpen, setIsImageUploadModalOpen] = useState(false);
// store hooks
const {
user: { updateCurrentUser },
} = useMobxStore();
const { updateCurrentUser } = useUser();
// form info
const {
getValues,

View file

@ -1,3 +1,5 @@
"use client";
// icons
import { CircleCheck } from "lucide-react";
// helpers

View file

@ -1,3 +1,5 @@
"use client";
import React, { FC } from "react";
import Link from "next/link";
import { EAuthModes } from "./auth-forms";

View file

@ -1,3 +1,4 @@
"use client";
import React, { useState } from "react";
import { observer } from "mobx-react-lite";
import { useDropzone } from "react-dropzone";
@ -27,7 +28,7 @@ export const UserImageUploadModal: React.FC<Props> = observer((props) => {
const [image, setImage] = useState<File | null>(null);
const [isImageUploading, setIsImageUploading] = useState(false);
// store hooks
const { instance } = useInstance();
const { config: instanceConfig } = useInstance();
const onDrop = (acceptedFiles: File[]) => setImage(acceptedFiles[0]);
@ -36,7 +37,7 @@ export const UserImageUploadModal: React.FC<Props> = observer((props) => {
accept: {
"image/*": [".png", ".jpg", ".jpeg", ".svg", ".webp"],
},
maxSize: instance?.config?.file_size_limit ?? MAX_FILE_SIZE,
maxSize: (instanceConfig?.file_size_limit as number) ?? MAX_FILE_SIZE,
multiple: false,
});

View file

@ -1,3 +1,5 @@
"use client";
import Image from "next/image";
// hooks
import { useUser } from "@/hooks/store";