- ) => {
+ const handleNewCommentChange = () => {
// add new comment - then merge to comments list
};
diff --git a/src/features/Project/SprintBoard/SprintTask/index.ts b/src/features/Project/SprintBoard/SprintTask/index.ts
index 7127bbb..f739899 100644
--- a/src/features/Project/SprintBoard/SprintTask/index.ts
+++ b/src/features/Project/SprintBoard/SprintTask/index.ts
@@ -1,2 +1,2 @@
-export { SprintTask } from "./SprintTask";
export { AddTask } from "./AddTask";
+export { SprintTask } from "./SprintTask";
diff --git a/src/features/Project/SprintBoard/helpers.ts b/src/features/Project/SprintBoard/helpers.ts
deleted file mode 100644
index 01d9131..0000000
--- a/src/features/Project/SprintBoard/helpers.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import {
- Column,
- ColumnDict,
- User,
- Task,
- TaskDict,
- UserDict,
-} from "../../../types";
-
-export function makeUserDict(users: User[] | undefined): UserDict | undefined {
- if (!users) {
- return;
- }
- return (users || []).reduce((acc, curr) => {
- return {
- ...acc,
- [`${curr.id}`]: {
- ...curr,
- },
- };
- }, {});
-}
-
-export function makeColumnsDict(columns: Column[]): ColumnDict {
- return Object.keys(columns).reduce((acc: any, key: any) => {
- return {
- ...acc,
- ...{
- [columns[key].columnName.toString()]: { ...columns[key] },
- },
- };
- }, {});
-}
-
-export function makeTasksDict(tasks: Task[]): TaskDict {
- return Object.keys(tasks).reduce((acc: any, key: any) => {
- return {
- ...acc,
- ...{
- [tasks[key].id.toString()]: { ...tasks[key] },
- },
- };
- }, {});
-}
diff --git a/src/features/Project/UsersTable.tsx b/src/features/Project/UsersTable.tsx
index 21f47a4..d27a605 100644
--- a/src/features/Project/UsersTable.tsx
+++ b/src/features/Project/UsersTable.tsx
@@ -1,15 +1,15 @@
-import React from "react";
+import Paper from "@mui/material/Paper";
+import { styled } from "@mui/material/styles";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableHead from "@mui/material/TableHead";
import TableRow from "@mui/material/TableRow";
-import Paper from "@mui/material/Paper";
-import { styled } from "@mui/material/styles";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
-import { User } from "../../types";
+import React from "react";
+import { User } from "types/user";
dayjs.extend(relativeTime);
diff --git a/src/features/Project/index.ts b/src/features/Project/index.ts
index 03e0d32..6ce6b68 100644
--- a/src/features/Project/index.ts
+++ b/src/features/Project/index.ts
@@ -1,2 +1,3 @@
import { SelectedProject } from "./Project";
+
export default SelectedProject;
diff --git a/src/features/Projects/Card/Card.tsx b/src/features/Projects/Card/Card.tsx
index a4554b4..69e1bef 100644
--- a/src/features/Projects/Card/Card.tsx
+++ b/src/features/Projects/Card/Card.tsx
@@ -1,19 +1,13 @@
import React, { useState } from "react";
import { Link } from "react-router-dom";
import { styled } from "@mui/material/styles";
-import { useTenantMap } from "../../../hooks/users";
-import { Loader } from "../../../components/Loader";
+import { useTenantMap } from "hooks/users";
+import { Loader } from "components/Loader";
import PushPinIcon from "@mui/icons-material/PushPin";
-import {
- assignColor,
- getOrgs,
- getPinState,
- PinnedProject,
- orderBy,
-} from "../../../helpers";
+import { assignColor, getOrgs, getPinState, orderBy } from "helpers/helpers";
import IconButton from "@mui/material/IconButton";
-import { usePinned } from "../../../services/PinnedProvider";
-import { Project } from "../../../types";
+import { usePinned } from "services/PinnedProvider";
+import { Project, PinnedProject } from "types/project";
interface Props {
project: Project;
diff --git a/src/features/Projects/List/List.tsx b/src/features/Projects/List/List.tsx
index 9810a24..4e3d8da 100644
--- a/src/features/Projects/List/List.tsx
+++ b/src/features/Projects/List/List.tsx
@@ -2,9 +2,9 @@ import React from "react";
import { CircularProgress, Grid } from "@mui/material";
import { Card } from "../Card";
import { styled } from "@mui/material/styles";
-import { orderBy } from "../../../helpers";
-import { useProjects } from "../../../hooks/project";
-import { Project } from "../../../types";
+import { orderBy } from "helpers/helpers";
+import { useProjects } from "hooks/project";
+import { Project } from "types/project";
const renderProjectCards = (projects: Project[]) => {
return orderBy("name", projects).map((project: Project) => (
diff --git a/src/features/Projects/Projects.tsx b/src/features/Projects/Projects.tsx
index de0ab81..9319a26 100644
--- a/src/features/Projects/Projects.tsx
+++ b/src/features/Projects/Projects.tsx
@@ -4,9 +4,9 @@ import Fab from "@mui/material/Fab";
import Add from "@mui/icons-material/Add";
import { List } from "./List";
import { Modal } from "./Modal";
-import { useCreateProject } from "../../hooks/project";
+import { useCreateProject } from "hooks/project";
import { styled } from "@mui/material/styles";
-import { Layout } from "../../Layout";
+import { Layout } from "components/Layout";
export const Projects = () => {
const [isOpen, setOpen] = useState(false);
diff --git a/src/helpers.ts b/src/helpers.ts
deleted file mode 100644
index e6e3f20..0000000
--- a/src/helpers.ts
+++ /dev/null
@@ -1,107 +0,0 @@
-import { TMap, Project } from "./types";
-
-export function getUserInitials(firstName: string, lastName: string) {
- return firstName.substring(0, 1) + (lastName || "").substring(0, 1);
-}
-
-export const formatPath = (company: string | undefined): string => {
- if (!company) {
- return "";
- }
- const re = /[^a-zA-Z0-9]+/g;
-
- return company.replaceAll(re, "").toLowerCase();
-};
-
-interface Organization {
- id: string;
- path: string;
- name: string;
- color?: string;
-}
-
-export const getOrgs = (data: TMap) => {
- return Object.keys(data).map((id) => ({
- path: data[id].path,
- id: data[id].id,
- name: data[id].company,
- })) as Organization[];
-};
-
-export function assignColor
(obj: T, index: number) {
- return {
- ...obj,
- color: `badge${(index % 9) + 1}`,
- };
-}
-
-export interface PinnedProject {
- tenantPath: string;
- projectId: string;
- name: string;
-}
-
-export const getPinState = (project: Project) => {
- const pinnedSettings = localStorage.getItem("settings.pinned");
- if (pinnedSettings) {
- const data = JSON.parse(pinnedSettings);
- if (data && data.length) {
- return !!data.find((obj: PinnedProject) => {
- return obj.projectId === project.id;
- });
- }
- }
-
- return false;
-};
-
-export const findPinnedByPath = (
- settings: PinnedProject[],
- path: string
-): PinnedProject[] => {
- if (settings) {
- if (settings && settings.length) {
- return settings.filter((obj: PinnedProject) => {
- return obj.tenantPath === path;
- });
- }
- }
-
- return [];
-};
-
-type SortBy = "asc" | "desc";
-
-// Sorts values by given key in descending order unless ascending order is specified.
-function orderBy(key: string, values: T[], sortBy: SortBy = "desc") {
- return values.sort(
- (a: { [index: string]: any }, b: { [index: string]: any }) => {
- let fieldA, fieldB;
-
- try {
- // Assume it's a string.
- fieldA = a[key].toLowerCase();
- fieldB = b[key].toLowerCase();
- } catch {
- fieldA = a[key];
- fieldB = b[key];
- }
-
- if (sortBy === "desc") {
- return sortByDesc(fieldA, fieldB);
- } else {
- return sortByAsc(fieldA, fieldB);
- }
- }
- );
-}
-
-const sortByDesc = (a: any, b: any) => {
- return a > b ? 1 : a < b ? -1 : 0;
-};
-
-const sortByAsc = (a: any, b: any) => {
- return a < b ? 1 : a > b ? -1 : 0;
-};
-
-export { orderBy };
diff --git a/src/helpers/helpers.ts b/src/helpers/helpers.ts
new file mode 100644
index 0000000..4fedace
--- /dev/null
+++ b/src/helpers/helpers.ts
@@ -0,0 +1,122 @@
+import { Column, ColumnDict, Task, TaskDict } from "types/board";
+import { PinnedProject, Project } from "types/project";
+import { Organization, TMap } from "types/tenant";
+import { User, UserDict } from "types/user";
+
+export function getUserInitials(firstName: string, lastName: string) {
+ return firstName.substring(0, 1) + (lastName || "").substring(0, 1);
+}
+
+export function formatPath(company: string | undefined): string {
+ if (!company) {
+ return "";
+ }
+ const re = /[^a-zA-Z0-9]+/g;
+ return company.replaceAll(re, "").toLowerCase();
+}
+
+export function getOrgs(data: TMap) {
+ return Object.keys(data).map((id) => ({
+ path: data[id].path,
+ id: data[id].id,
+ name: data[id].company,
+ })) as Organization[];
+}
+
+export function assignColor(obj: T, index: number) {
+ return {
+ ...obj,
+ color: `badge${(index % 9) + 1}`,
+ };
+}
+
+export function getPinState(project: Project) {
+ const pinnedSettings = localStorage.getItem("settings.pinned") || "[]";
+ const data = JSON.parse(pinnedSettings);
+ if (data.length) {
+ return !!data.find((obj: PinnedProject) => {
+ return obj.projectId === project.id;
+ });
+ }
+ return false;
+}
+
+export function findPinnedByPath(
+ pinned: PinnedProject[],
+ path: string
+): PinnedProject[] {
+ if (pinned && pinned.length) {
+ return pinned.filter((obj: PinnedProject) => {
+ return obj.tenantPath === path;
+ });
+ }
+ return [];
+}
+
+type SortBy = "asc" | "desc";
+// Sorts values by given key in descending order unless ascending order is specified.
+export function orderBy(key: string, values: T[], sortBy: SortBy = "desc") {
+ return values.sort(
+ (a: { [index: string]: any }, b: { [index: string]: any }) => {
+ let fieldA, fieldB;
+ try {
+ // Assume it's a string.
+ fieldA = a[key].toLowerCase();
+ fieldB = b[key].toLowerCase();
+ } catch {
+ fieldA = a[key];
+ fieldB = b[key];
+ }
+
+ if (sortBy === "desc") {
+ return sortByDesc(fieldA, fieldB);
+ } else {
+ return sortByAsc(fieldA, fieldB);
+ }
+ }
+ );
+}
+
+function sortByDesc(a: any, b: any) {
+ return a > b ? 1 : a < b ? -1 : 0;
+}
+
+function sortByAsc(a: any, b: any) {
+ return a < b ? 1 : a > b ? -1 : 0;
+}
+
+export function makeUserDict(users: User[] | undefined): UserDict | undefined {
+ if (!users) {
+ return;
+ }
+ return (users || []).reduce((acc, curr) => {
+ return {
+ ...acc,
+ [`${curr.id}`]: {
+ ...curr,
+ },
+ };
+ }, {});
+}
+
+export function makeColumnsDict(columns: Column[]): ColumnDict {
+ return Object.keys(columns).reduce((acc: any, key: any) => {
+ return {
+ ...acc,
+ ...{
+ [columns[key].columnName.toString()]: { ...columns[key] },
+ },
+ };
+ }, {});
+}
+
+export function makeTasksDict(tasks: Task[]): TaskDict {
+ return Object.keys(tasks).reduce((acc: any, key: any) => {
+ return {
+ ...acc,
+ ...{
+ [tasks[key].id.toString()]: { ...tasks[key] },
+ },
+ };
+ }, {});
+}
diff --git a/src/hooks/board.ts b/src/hooks/board.ts
index 48b0c67..7475049 100644
--- a/src/hooks/board.ts
+++ b/src/hooks/board.ts
@@ -1,6 +1,6 @@
-import { client as api } from "../services/APIService";
import { useMutation, useQuery, useQueryClient } from "react-query";
-import { Task, AddTask, DeleteTask, MoveTask, Column } from "../types";
+import { client as api } from "services/APIService";
+import { AddTask, Column, DeleteTask, MoveTask, Task } from "types/board";
export function useColumns(projectId: string) {
return useQuery(["project", projectId, "columns"], () => {
@@ -73,7 +73,7 @@ export function useDeleteTask() {
queryClient.setQueryData(
["project", variables.projectId, "columns"],
(prev) => {
- let state = prev as Column[];
+ const state = prev as Column[];
const column = (state || []).find((item) => {
return item.columnName === variables.columnId;
diff --git a/src/hooks/invites.ts b/src/hooks/invites.ts
index 2b5aab6..8bcfc9b 100644
--- a/src/hooks/invites.ts
+++ b/src/hooks/invites.ts
@@ -1,19 +1,6 @@
import { useMutation, useQuery, useQueryClient } from "react-query";
-import { Invite } from "../components/TopBar/types";
-import { client as api } from "../services/APIService";
-
-export function useCreateInvite() {
- const { mutate } = useMutation<
- Invite,
- Error,
- { teamId: string; emailList: string[] }
- >(({ teamId, emailList }) =>
- api.post(`/users/teams/${teamId}/invites`, {
- emailList,
- })
- );
- return [mutate];
-}
+import { Invite } from "types/invite";
+import { client as api } from "services/APIService";
export function useInvites() {
return useQuery(
diff --git a/src/hooks/project.ts b/src/hooks/project.ts
index c72cbf6..dcea8eb 100644
--- a/src/hooks/project.ts
+++ b/src/hooks/project.ts
@@ -1,7 +1,7 @@
-import { useQuery, useQueryClient, useMutation } from "react-query";
-import { client as api } from "../services/APIService";
+import { useMutation, useQuery, useQueryClient } from "react-query";
import { useNavigate } from "react-router-dom";
-import { Project } from "../types";
+import { client as api } from "services/APIService";
+import { Project } from "types/project";
export function useProject(projectId: string | undefined) {
return useQuery(
@@ -51,7 +51,7 @@ export function useUpdateProject() {
...rest,
}),
{
- onSuccess: (data, variables) => {
+ onSuccess: (data) => {
queryClient.setQueryData(["project", data.id], data);
},
}
diff --git a/src/hooks/users.ts b/src/hooks/users.ts
index 01ca9f7..c823b58 100644
--- a/src/hooks/users.ts
+++ b/src/hooks/users.ts
@@ -1,17 +1,16 @@
+import { Auth } from "aws-amplify";
import { useMemo } from "react";
import { useMutation, useQuery, useQueryClient } from "react-query";
-import { client as api } from "../services/APIService";
-import { Auth } from "aws-amplify";
+import { client as api } from "services/APIService";
+import { SeatsAvailable, TMap } from "types/tenant";
import {
+ CurrentUser,
+ DeleteUserInput,
NewUser,
- SeatsAvailable,
+ TableUser,
User,
- DeleteUserInput,
- CurrentUser,
UserQuery,
- TableUser,
- TMap,
-} from "../types";
+} from "types/user";
export function useUser() {
const { isLoading, isError, data } = useQuery(
diff --git a/src/index.tsx b/src/index.tsx
index 1435250..a2d538e 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,7 +1,23 @@
+import "@aws-amplify/ui-react/styles.css";
+import "./index.css";
+
+import { Image, View, withAuthenticator } from "@aws-amplify/ui-react";
+import Copyright from "@mui/icons-material/Copyright";
+import {
+ styled,
+ StyledEngineProvider,
+ ThemeProvider,
+} from "@mui/material/styles";
+import Amplify from "aws-amplify";
+import { Loader } from "components/Loader";
+import { SideBar } from "components/SideBar";
+import { TopBar } from "components/TopBar/TopBar";
+import { formatPath } from "helpers/helpers";
+import { useUser } from "hooks/users";
import React, { lazy } from "react";
import { createRoot } from "react-dom/client";
-import { ReactQueryDevtools } from "react-query/devtools";
import { QueryClient, QueryClientProvider } from "react-query";
+import { ReactQueryDevtools } from "react-query/devtools";
import {
BrowserRouter,
Navigate,
@@ -10,26 +26,10 @@ import {
Routes,
useParams,
} from "react-router-dom";
+import { PinnedProvider } from "services/PinnedProvider";
-import { theme } from "./theme";
-import {
- styled,
- StyledEngineProvider,
- ThemeProvider,
-} from "@mui/material/styles";
-import "@aws-amplify/ui-react/styles.css";
-import "./index.css";
-
-import { View, Image, withAuthenticator } from "@aws-amplify/ui-react";
-import Amplify from "aws-amplify";
import awsconfig from "./aws-exports";
-import { useUser } from "./hooks/users";
-import { formatPath } from "./helpers";
-import { Loader } from "./components/Loader";
-import { SideBar } from "./components/SideBar";
-import Copyright from "@mui/icons-material/Copyright";
-import { TopBar } from "./components/TopBar/TopBar";
-import { PinnedProvider } from "./services/PinnedProvider";
+import { theme } from "./theme";
Amplify.configure({
...awsconfig,
@@ -37,11 +37,11 @@ Amplify.configure({
userPoolWebClientId: process.env.REACT_APP_USER_POOL_CLIENT_ID,
});
-const Account = lazy(() => import("./features/Account"));
-const NoMatch = lazy(() => import("./features/NoMatch"));
-const Profile = lazy(() => import("./features/Profile"));
-const Projects = lazy(() => import("./features/Projects"));
-const SelectedProject = lazy(() => import("./features/Project"));
+const Account = lazy(() => import("features/Account"));
+const NoMatch = lazy(() => import("features/NoMatch"));
+const Profile = lazy(() => import("features/Profile"));
+const Projects = lazy(() => import("features/Projects"));
+const SelectedProject = lazy(() => import("features/Project"));
const queryClient = new QueryClient();
diff --git a/src/services/APIService.ts b/src/services/APIService.ts
index ad419c4..5c88370 100644
--- a/src/services/APIService.ts
+++ b/src/services/APIService.ts
@@ -7,16 +7,16 @@ class APIService {
this.baseUrl = process.env.REACT_APP_BACKEND || "http://localhost/api";
}
- post(path: string, data: any) {
- return this.request("POST", path, data);
+ post(path: string, data: T) {
+ return this.request("POST", path, data);
}
- put(path: string, data: any) {
- return this.request("PUT", path, data);
+ put(path: string, data: T) {
+ return this.request("PUT", path, data);
}
- patch(path: string, data: any) {
- return this.request("PATCH", path, data);
+ patch(path: string, data: T) {
+ return this.request("PATCH", path, data);
}
get(path: string) {
@@ -40,7 +40,7 @@ class APIService {
return window.location.pathname.split("/")[1];
}
- async request(method: string, path: string, data?: any) {
+ async request(method: string, path: string, data?: T) {
const url = `${this.baseUrl}${path}`;
const session = await Auth.currentSession();
const accessToken = session.getIdToken().getJwtToken();
diff --git a/src/services/PinnedProvider.tsx b/src/services/PinnedProvider.tsx
index c579a3c..e3bc515 100644
--- a/src/services/PinnedProvider.tsx
+++ b/src/services/PinnedProvider.tsx
@@ -1,5 +1,5 @@
import React, { PropsWithChildren, useState } from "react";
-import { PinnedProject } from "../helpers";
+import { PinnedProject } from "types/project";
interface PinnedCtx {
pinned: PinnedProject[];
@@ -9,7 +9,7 @@ interface PinnedCtx {
const PinnedContext = React.createContext(undefined);
export function PinnedProvider({ children }: PropsWithChildren) {
- let settings = localStorage.getItem("settings.pinned") || "[]";
+ const settings = localStorage.getItem("settings.pinned") || "[]";
const totalPinned = JSON.parse(settings) as PinnedProject[];
const [pinned, setPinned] = useState(totalPinned);
diff --git a/src/types.ts b/src/types.ts
deleted file mode 100644
index aafaf39..0000000
--- a/src/types.ts
+++ /dev/null
@@ -1,144 +0,0 @@
-import { UseQueryResult } from "react-query";
-
-export interface User {
- id: string;
- email: string;
- emailVerified: boolean;
- firstName: string;
- lastName: string;
- picture: string;
- locale: string;
- company?: string;
- updatedAt: string;
- createdAt: string;
-}
-
-export interface UserDict {
- [index: string]: User;
-}
-
-export type CurrentUser = User & {
- tenantId: string;
- company: string;
- accountOwner: boolean;
- connections: ConnectionMap;
- username: string;
-};
-
-interface ConnectionMap {
- [index: string]: Connection;
-}
-
-type Connection = {
- id: string;
- path: string;
- plan: string;
- companyName: string;
-};
-
-export interface NewUser {
- email: string;
- firstName: string;
- lastName: string;
- company: string;
-}
-
-export interface DeleteUserInput {
- userId: string;
-}
-
-export interface SeatsAvailable {
- maxSeats: number;
- seatsAvailable: number;
-}
-
-export interface TableUser {
- id: string;
- user: {
- firstName: string;
- lastName: string;
- };
- email: string;
- createdAt: string;
-}
-
-export type UserQuery = UseQueryResult;
-
-export interface ColumnDict {
- [index: string]: Column;
-}
-
-export interface TaskDict {
- [index: string]: Task;
-}
-
-export interface Project {
- id: string;
- name: string;
- prefix: string;
- description: string;
- tenantId: string;
- userId: string;
- active: boolean;
- public: boolean;
- columnOrder: string[];
- createdAt: string;
- updatedAt: string;
-}
-
-export interface Board {
- columns: ColumnDict;
- tasks: TaskDict;
-}
-
-export interface Column {
- id: string;
- projectId: string;
- title: string;
- columnName: string;
- taskIds: string[];
- created: string;
-}
-
-export interface Task {
- id: string;
- key: string;
- seq: number;
- title: string;
- points: number;
- assignedTo: string;
- comments: string[];
- attachments: string[];
- content: string;
- projectId: string;
- createdAt: string;
- updatedAt: string;
-}
-
-export interface AddTask {
- projectId: string;
- columnId: string;
- task: string;
-}
-
-export interface DeleteTask {
- projectId: string;
- columnId: string;
- taskId: string;
-}
-
-export interface MoveTask {
- projectId: string;
- to: string;
- from: string;
- taskId: string;
- taskIds: string[];
-}
-
-export interface TMap {
- [index: string]: {
- path: string;
- company: string;
- id: string;
- };
-}
diff --git a/src/types/board.ts b/src/types/board.ts
new file mode 100644
index 0000000..c95d7bf
--- /dev/null
+++ b/src/types/board.ts
@@ -0,0 +1,56 @@
+export interface Board {
+ columns: ColumnDict;
+ tasks: TaskDict;
+}
+
+export interface ColumnDict {
+ [index: string]: Column;
+}
+
+export interface TaskDict {
+ [index: string]: Task;
+}
+
+export interface Column {
+ id: string;
+ projectId: string;
+ title: string;
+ columnName: string;
+ taskIds: string[];
+ created: string;
+}
+
+export interface Task {
+ id: string;
+ key: string;
+ seq: number;
+ title: string;
+ points: number;
+ assignedTo: string;
+ comments: string[];
+ attachments: string[];
+ content: string;
+ projectId: string;
+ createdAt: string;
+ updatedAt: string;
+}
+
+export interface AddTask {
+ projectId: string;
+ columnId: string;
+ task: string;
+}
+
+export interface DeleteTask {
+ projectId: string;
+ columnId: string;
+ taskId: string;
+}
+
+export interface MoveTask {
+ projectId: string;
+ to: string;
+ from: string;
+ taskId: string;
+ taskIds: string[];
+}
diff --git a/src/components/TopBar/types.ts b/src/types/invite.ts
similarity index 90%
rename from src/components/TopBar/types.ts
rename to src/types/invite.ts
index dd0a2e0..7f61718 100644
--- a/src/components/TopBar/types.ts
+++ b/src/types/invite.ts
@@ -2,7 +2,6 @@ export interface Invite {
id: string;
userId: string;
teamId: string;
- teamName: string;
read: boolean;
accepted: boolean;
expiration: string;
diff --git a/src/types/project.ts b/src/types/project.ts
new file mode 100644
index 0000000..d48f0cf
--- /dev/null
+++ b/src/types/project.ts
@@ -0,0 +1,19 @@
+export interface Project {
+ id: string;
+ name: string;
+ prefix: string;
+ description: string;
+ tenantId: string;
+ userId: string;
+ active: boolean;
+ public: boolean;
+ columnOrder: string[];
+ createdAt: string;
+ updatedAt: string;
+}
+
+export interface PinnedProject {
+ tenantPath: string;
+ projectId: string;
+ name: string;
+}
diff --git a/src/types/tenant.ts b/src/types/tenant.ts
new file mode 100644
index 0000000..1f5f359
--- /dev/null
+++ b/src/types/tenant.ts
@@ -0,0 +1,30 @@
+export interface ConnectionMap {
+ [index: string]: Connection;
+}
+
+export type Connection = {
+ id: string;
+ path: string;
+ plan: string;
+ companyName: string;
+};
+
+export interface Organization {
+ id: string;
+ path: string;
+ name: string;
+ color?: string;
+}
+
+export interface SeatsAvailable {
+ maxSeats: number;
+ seatsAvailable: number;
+}
+
+export interface TMap {
+ [index: string]: {
+ path: string;
+ company: string;
+ id: string;
+ };
+}
diff --git a/src/types/user.ts b/src/types/user.ts
new file mode 100644
index 0000000..5c32241
--- /dev/null
+++ b/src/types/user.ts
@@ -0,0 +1,51 @@
+import { UseQueryResult } from "react-query";
+
+import { ConnectionMap } from "./tenant";
+
+export interface User {
+ id: string;
+ email: string;
+ emailVerified: boolean;
+ firstName: string;
+ lastName: string;
+ picture: string;
+ locale: string;
+ company?: string;
+ updatedAt: string;
+ createdAt: string;
+}
+
+export interface UserDict {
+ [index: string]: User;
+}
+
+export type CurrentUser = User & {
+ tenantId: string;
+ company: string;
+ accountOwner: boolean;
+ connections: ConnectionMap;
+ username: string;
+};
+
+export interface NewUser {
+ email: string;
+ firstName: string;
+ lastName: string;
+ company: string;
+}
+
+export interface DeleteUserInput {
+ userId: string;
+}
+
+export interface TableUser {
+ id: string;
+ user: {
+ firstName: string;
+ lastName: string;
+ };
+ email: string;
+ createdAt: string;
+}
+
+export type UserQuery = UseQueryResult;
diff --git a/tsconfig.json b/tsconfig.json
index 74463f8..d25f2e4 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,5 +1,6 @@
{
"compilerOptions": {
+ "baseUrl": "src",
"target": "es5",
"lib": [
"dom",