Skip to content

Commit 4f9a138

Browse files
committed
2 parents a229768 + 6866ee2 commit 4f9a138

File tree

7 files changed

+44
-56
lines changed

7 files changed

+44
-56
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "plexo-platform",
3-
"version": "0.1.11",
3+
"version": "0.1.12",
44
"private": false,
55
"scripts": {
66
"generate": "graphql-codegen -c codegen.yml",

src/components/ui/Task/newSubtasks.tsx

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ const NewSubTasks = ({ subtasks, setSubtasks }: NewSubTasks) => {
3131
const [status, setStatus] = useState<TaskStatus>(TaskStatus.Backlog);
3232
const [lead, setLead] = useState<Member | null>(null);
3333

34-
const handleAddSubtask = () => {
34+
const handleAddSubtask = (event: { preventDefault: () => void; }) => {
35+
event.preventDefault();
3536
setSubtasks([
3637
...subtasks,
3738
{
@@ -90,34 +91,37 @@ const NewSubTasks = ({ subtasks, setSubtasks }: NewSubTasks) => {
9091
<Text p={"xs"} size={"xs"}>
9192
Sub-tasks
9293
</Text>
93-
<Group spacing={0} px={6} py={4}>
94-
<StatusSelector status={status} setStatus={setStatus} type="icon" />
95-
<LeadTaskSelector lead={lead} setLead={setLead} type="icon" />
94+
<form onSubmit={handleAddSubtask}>
95+
<Group spacing={0} px={6} py={4}>
96+
<StatusSelector status={status} setStatus={setStatus} type="icon" />
97+
<LeadTaskSelector lead={lead} setLead={setLead} type="icon" />
9698

97-
<TextInput
98-
autoFocus
99-
placeholder="Task Title"
100-
variant="unstyled"
101-
value={title}
102-
onChange={e => setTitle(e.target.value)}
103-
styles={{
104-
root: {
105-
flexGrow: 1,
106-
},
107-
}}
108-
/>
99+
<TextInput
100+
autoFocus
101+
placeholder="Task Title"
102+
variant="unstyled"
103+
value={title}
104+
onChange={e => setTitle(e.target.value)}
105+
styles={{
106+
root: {
107+
flexGrow: 1,
108+
},
109+
}}
110+
/>
109111

110-
<Button
111-
compact
112-
disabled={title.length ? false : true}
113-
variant="light"
114-
color={"brand"}
115-
leftIcon={<Plus size={16} />}
116-
onClick={handleAddSubtask}
117-
>
118-
<Text size={"xs"}>Add subtask</Text>
119-
</Button>
120-
</Group>
112+
<Button
113+
compact
114+
disabled={title.length ? false : true}
115+
variant="light"
116+
color={"brand"}
117+
leftIcon={<Plus size={16} />}
118+
type="submit"
119+
120+
>
121+
<Text size={"xs"}>Add subtask</Text>
122+
</Button>
123+
</Group>
124+
</form>
121125
<Stack spacing={1}>{tasks.length ? tasks : null}</Stack>
122126
</Stack>
123127
);

src/context/PlexoContext.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { Label, Member, Project, Task, Team, User } from "lib/types";
1313
type PlexoProviderProps = {
1414
children: ReactNode;
1515
authCookie?: string;
16-
authEmailURL?: string;
1716
};
1817

1918
type PlexoContextProps = {
@@ -28,7 +27,6 @@ type PlexoContextProps = {
2827
createMoreTasks: boolean;
2928
setCreateMoreTasks: (createMoreTasks: boolean) => void;
3029
authCookie: string | undefined;
31-
authEmailURL: string | undefined;
3230
setAuthCookie: (authCookie: string) => void;
3331
userData: User | undefined;
3432
isLoadingUser: boolean;
@@ -52,7 +50,7 @@ export const usePlexoContext = () => {
5250
return context;
5351
};
5452

55-
const PlexoProvider = ({ authCookie, authEmailURL, children }: PlexoProviderProps) => {
53+
const PlexoProvider = ({ authCookie, children }: PlexoProviderProps) => {
5654
const [taskId, setTaskId] = useState<string | undefined>(undefined);
5755
const [tasks, setTasks] = useState<Task[] | undefined>(undefined);
5856

@@ -129,7 +127,6 @@ const PlexoProvider = ({ authCookie, authEmailURL, children }: PlexoProviderProp
129127
setCreateMoreTasks,
130128
authCookie: authCookieState,
131129
setAuthCookie,
132-
authEmailURL,
133130
taskId,
134131
setTaskId,
135132
tasks,

src/lib/auth.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
export const loginWithEmail = async ({
2-
authEmailURL,
3-
email,
4-
password,
5-
}: {
6-
authEmailURL: string | undefined;
7-
email: string;
8-
password: string;
9-
}) => {
1+
const loginURL = process.env.NEXT_PUBLIC_URL_EMAIL_AUTH || "/api/auth/email/login";
2+
3+
export const loginWithEmail = async ({ email, password }: { email: string; password: string }) => {
104
try {
11-
const res = await fetch(authEmailURL || "/api/auth/email/login", {
5+
const res = await fetch(loginURL, {
126
method: "POST",
137
headers: {
148
"Content-Type": "application/json",

src/lib/client.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
import { devtoolsExchange } from "@urql/devtools";
1+
// import { devtoolsExchange } from "@urql/devtools";
22
import {
33
cacheExchange,
44
CombinedError,
55
createClient,
6-
dedupExchange,
6+
// dedupExchange,
77
errorExchange,
88
fetchExchange,
99
subscriptionExchange,
1010
} from "urql";
1111
import { createClient as createWSClient } from "graphql-ws";
1212

13-
export const URQLClient = ({ graphQLEndpoint }: { graphQLEndpoint?: string }) => {
13+
export const URQLClient = () => {
1414
// console.log("CREATING URQL CLIENT");
1515

16-
const GRAPHQL_ENDPOINT =
17-
process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT || graphQLEndpoint || "/graphql";
16+
const GRAPHQL_ENDPOINT = process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT || "/graphql";
1817

1918
const WS_ENDPOINT = process.env.NEXT_PUBLIC_WS_ENDPOINT || "/graphql/ws";
2019

@@ -34,7 +33,7 @@ export const URQLClient = ({ graphQLEndpoint }: { graphQLEndpoint?: string }) =>
3433
},
3534
},
3635
exchanges: [
37-
devtoolsExchange,
36+
// devtoolsExchange,
3837
// dedupExchange,
3938
cacheExchange,
4039
errorExchange({

src/pages/_app.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ColorScheme } from "@mantine/core";
22
import type { AppProps } from "next/app";
33
import { getCookie } from "cookies-next";
4-
import { ReactElement, ReactNode, useState } from "react";
4+
import { ReactElement, ReactNode } from "react";
55
import { Provider as URQLProvider } from "urql";
66
import { GetServerSidePropsContext, NextPage } from "next";
77
import Head from "next/head";
@@ -24,14 +24,9 @@ type PlexoPlatformAppProps = {
2424
colorScheme: ColorScheme;
2525
viewMode: "list" | "grid";
2626
authCookie: string;
27-
//
28-
graphQLEndpoint: string | undefined;
29-
authEmailURL: string | undefined;
3027
};
3128

32-
const client = URQLClient({
33-
graphQLEndpoint: process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT,
34-
});
29+
const client = URQLClient();
3530

3631
const PlexoApp = ({
3732
Component,

src/pages/login/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const LoginPage = () => {
5959
setAuthResponse(undefined);
6060

6161
const response = await loginWithEmail({
62-
authEmailURL: plexo.authEmailURL,
6362
email: values.email,
6463
password: values.password,
6564
});

0 commit comments

Comments
 (0)