Add OAth flow for Gmail and update tables and UI

This commit is contained in:
cesnimda
2026-03-21 14:02:19 +01:00
parent 51a539068f
commit ed68e44eaf
17 changed files with 1180 additions and 53 deletions
@@ -1,4 +1,5 @@
import React, { useEffect, useMemo, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import {
Box,
@@ -25,6 +26,8 @@ import { useToast } from "../toast";
export default function CompaniesTable() {
const { toast } = useToast();
const location = useLocation();
const navigate = useNavigate();
const [companies, setCompanies] = useState<Company[]>([]);
const [editOpen, setEditOpen] = useState(false);
const [editing, setEditing] = useState<Company | null>(null);
@@ -40,6 +43,17 @@ export default function CompaniesTable() {
api.get<Company[]>("/companies").then((r) => setCompanies(r.data));
}, []);
useEffect(() => {
const params = new URLSearchParams(location.search);
const editId = Number(params.get("edit") || 0);
if (!editId || companies.length === 0) return;
const company = companies.find((c) => c.id === editId);
if (!company) return;
openEdit(company);
params.delete("edit");
navigate({ pathname: location.pathname, search: params.toString() ? `?${params.toString()}` : "" }, { replace: true });
}, [companies, location.pathname, location.search, navigate]);
const openEdit = (c: Company) => {
setEditing(c);
setRecruiterName(c.recruiterName ?? "");