Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions apps/frontend/src/app/accounts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@

import React from 'react';
import StaffCard from '../components/StaffCard';

interface User {
user_id: number;
name: string;
email: string;
is_admin: boolean;
created_at?: string;
}
import { User } from '@/types';

const mockUsers: User[] = [
{ user_id: 1, name: 'Mehana Nagarur', email: 'nagarur.m@northeastern.edu', is_admin: true },
Expand Down
9 changes: 2 additions & 7 deletions apps/frontend/src/app/components/AddExpenseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@ import DropdownSelector from './DropdownSelector';
import { useApi } from '@/hooks/useApi';
import FileUpload from './FileUpload';
import { FiDollarSign } from 'react-icons/fi';

interface Project {
project_id: number;
name: string;
}

import { Project } from '@/types';
interface AddExpenseModalProps {
open: boolean;
onClose: () => void;
onSuccess: () => void;
categories: string[];
projects: Project[];
projects: Pick<Project, 'project_id' | 'name'>[];
}

export default function AddExpenseModal({
Expand Down
12 changes: 1 addition & 11 deletions apps/frontend/src/app/components/ExpensesTable.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import {
Table,
} from '@chakra-ui/react';

export type Expenditure = {
expenditure_id: number;
project_id: number;
entered_by: number | null;
amount: string;
category: string | null;
description: string | null;
spent_on: string;
created_at: string | null;
};
import { Expenditure } from '@/types';

interface ExpensesTableProps {
expenditures: Expenditure[];
Expand Down
19 changes: 2 additions & 17 deletions apps/frontend/src/app/expenses/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,7 @@ import { CiFilter } from 'react-icons/ci';
import { LuArrowDownUp } from 'react-icons/lu';
import { FaPlus } from 'react-icons/fa';
import ExpensesTable from '../components/ExpensesTable';

type Expenditure = {
expenditure_id: number;
project_id: number;
entered_by: number | null;
amount: string;
category: string | null;
description: string | null;
spent_on: string;
created_at: string | null;
};

type Project = {
project_id: number;
name: string;
};
import { Expenditure, Project } from '@/types';

const MONTHS = [
'January', 'February', 'March', 'April', 'May', 'June',
Expand Down Expand Up @@ -61,7 +46,7 @@ function ExpensePageContent() {

// Data
const [expenditures, setExpenditures] = useState<Expenditure[]>([]);
const [projects, setProjects] = useState<Project[]>([]);
const [projects, setProjects] = useState<Pick<Project, 'project_id' | 'name'>[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);

Expand Down
20 changes: 1 addition & 19 deletions apps/frontend/src/app/projects/[id]/ProjectDetailClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,8 @@ import { RxCaretRight } from 'react-icons/rx';
import NavBar from '../../components/Navbar';
import ExpensesTable from '../../components/ExpensesTable';
import StaffCard from '../../components/StaffCard';
import type { Expenditure } from '../../components/ExpensesTable';
import { useApi } from '@/hooks/useApi';

type Project = {
project_id: number;
name: string;
description: string;
total_budget: string | null;
start_date: string | null;
end_date: string | null;
currency: string | null;
created_at: string | null;
};

type Member = {
user_id: number;
name: string;
email: string;
role: string;
};
import { Project, Expenditure, Member } from '@/types';

const PREVIEW_EXPENSES = 8;
const PREVIEW_STAFF = 4;
Expand Down
5 changes: 5 additions & 0 deletions apps/frontend/src/types/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface AuthUser {
sub: string;
email: string;
name?: string;
}
10 changes: 10 additions & 0 deletions apps/frontend/src/types/expenditure.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface Expenditure {
expenditure_id: number;
project_id: number;
entered_by: number | null;
amount: string;
category: string | null;
description: string | null;
spent_on: string;
created_at: string | null;
};
4 changes: 4 additions & 0 deletions apps/frontend/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './project';
export * from './expenditure';
export * from './user';
export * from './auth';
19 changes: 19 additions & 0 deletions apps/frontend/src/types/project.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export interface Project {
project_id: number;
name: string;
description: string;
total_budget: string | null;
start_date: string | null;
end_date: string | null;
currency: string | null;
created_at: string | null;
};

export type ProjectRole = 'PI' | 'Accountant' | 'Staff' | 'Admin';

export interface Member {
user_id: number;
name: string;
email: string;
role: ProjectRole;
}
8 changes: 8 additions & 0 deletions apps/frontend/src/types/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface User {
user_id: number;
name: string;
email: string;
is_admin: boolean;
created_at?: string;
profile_image?: string | null;
}
Loading