mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-18 13:34:06 +01:00
Merge branch 'dev' into back-end
This commit is contained in:
commit
9c6395078e
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -20,11 +20,11 @@ jobs:
|
||||
path: |
|
||||
~/.npm
|
||||
${{ github.workspace }}/.next/cache
|
||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
|
||||
key: ${{ runner.os }}-nextjs-${{ github.run_id }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
|
||||
- run: npm ci
|
||||
if: steps.ci-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Run build
|
||||
run: npm run build --if-present
|
||||
run: npm run build --if-present --verbose
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { SubmitHandler, useForm } from "react-hook-form";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
@ -10,12 +10,13 @@ import { getCurrentUserID } from "@/app/api/userApi";
|
||||
import { uploadFile } from "@/app/api/generalApi";
|
||||
import { Loader } from "@/components/loading/loader";
|
||||
import { hasUserApplied, transformChoice } from "./actions";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
type businessSchema = z.infer<typeof businessFormSchema>;
|
||||
const BUCKET_PITCH_NAME = "business-application";
|
||||
let supabase = createSupabaseClient();
|
||||
|
||||
export default function ApplyBusiness() {
|
||||
const router = useRouter();
|
||||
const alertShownRef = useRef(false);
|
||||
const [success, setSucess] = useState(false);
|
||||
|
||||
@ -74,7 +75,7 @@ export default function ApplyBusiness() {
|
||||
text: error == null ? "Your application has been submitted" : error.message,
|
||||
confirmButtonColor: error == null ? "green" : "red",
|
||||
}).then(() => {
|
||||
window.location.href = "/";
|
||||
router.push("/");
|
||||
});
|
||||
};
|
||||
|
||||
@ -97,7 +98,7 @@ export default function ApplyBusiness() {
|
||||
allowEscapeKey: false,
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = "/";
|
||||
router.push("/");
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -112,6 +113,7 @@ export default function ApplyBusiness() {
|
||||
};
|
||||
// setSucess(true);
|
||||
fetchUserData();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
@ -15,9 +15,11 @@ import { useQuery } from "@supabase-cache-helpers/postgrest-react-query";
|
||||
import { overAllGraphData, fourYearGraphData, dayOftheWeekData } from "../portfolio/[uid]/query";
|
||||
import CountUp from "react-countup";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function Dashboard() {
|
||||
const supabase = createSupabaseClient();
|
||||
const router = useRouter();
|
||||
const { session, loading: isLoadingSession } = useSession();
|
||||
const userId = session?.user.id;
|
||||
const [projects, setProjects] = useState<
|
||||
@ -234,7 +236,7 @@ export default function Dashboard() {
|
||||
</Card>
|
||||
<Button
|
||||
onClick={() => {
|
||||
window.location.href = `/project/${project.id}/edit`;
|
||||
router.push(`/project/${project.id}/edit`);
|
||||
}}
|
||||
className="h-full bg-emerald-500 hover:bg-emerald-800 font-bold text-xl"
|
||||
>
|
||||
|
||||
@ -29,7 +29,7 @@ async function getLatestInvestment(
|
||||
deals: { project_id: number; deal_amount: number; created_time: Date;}[]
|
||||
) {
|
||||
const llist = [];
|
||||
const count = 8;
|
||||
const count = 5;
|
||||
// select project name from the given id
|
||||
for (let i = deals.length - 1; i >= 0 && llist.length < count; --i) {
|
||||
let { data: project, error } = await supabase.from("project").select("project_name").eq("id", deals[i].project_id);
|
||||
|
||||
22
src/components/customToolTip.tsx
Normal file
22
src/components/customToolTip.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import React from "react";
|
||||
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "./ui/tooltip";
|
||||
|
||||
interface CustomTooltipProps {
|
||||
message: string;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
const CustomTooltip: React.FC<CustomTooltipProps> = ({ message, children }) => {
|
||||
return (
|
||||
<TooltipProvider delayDuration={0.5}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>{children}</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>{message}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export default CustomTooltip;
|
||||
@ -10,9 +10,10 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
||||
import { Bell, Heart, Wallet } from "lucide-react";
|
||||
import { Bell, Heart, Wallet, ChartPie } from "lucide-react";
|
||||
import { LogoutButton } from "@/components/auth/logoutButton";
|
||||
import { useUserRole } from "@/hooks/useUserRole";
|
||||
import CustomTooltip from "../customToolTip";
|
||||
|
||||
interface AuthenticatedComponentsProps {
|
||||
uid: string;
|
||||
@ -28,22 +29,36 @@ export const AuthenticatedComponents = ({ uid, avatarUrl, notificationCount }: A
|
||||
|
||||
return (
|
||||
<div className={`flex gap-3 pl-2 items-center ${businessClass}`}>
|
||||
<Link href={"/notification"}>
|
||||
<div className="relative inline-block">
|
||||
<Bell className="h-6 w-6 " />
|
||||
{notificationCount >= 1 && (
|
||||
<span className="absolute -top-1 -right-1 inline-flex items-center justify-center w-4 h-4 text-xs font-bold text-white bg-red-600 rounded-full animate-ping">
|
||||
{notificationCount}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
<Link href="/follow">
|
||||
<Heart />
|
||||
</Link>
|
||||
<Link href={"/portfolio/" + uid}>
|
||||
<Wallet className="cursor-pointer" />
|
||||
</Link>
|
||||
<CustomTooltip message="Notification">
|
||||
<Link href={"/notification"}>
|
||||
<div className="relative inline-block">
|
||||
<Bell className="h-6 w-6 " />
|
||||
{notificationCount >= 1 && (
|
||||
<span className="absolute -top-1 -right-1 inline-flex items-center justify-center w-4 h-4 text-xs font-bold text-white bg-red-600 rounded-full animate-ping">
|
||||
{notificationCount}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
</CustomTooltip>
|
||||
<CustomTooltip message="Followed">
|
||||
<Link href="/follow">
|
||||
<Heart />
|
||||
</Link>
|
||||
</CustomTooltip>
|
||||
<CustomTooltip message="Portfolio">
|
||||
<Link href={"/portfolio/" + uid}>
|
||||
<Wallet className="cursor-pointer" />
|
||||
</Link>
|
||||
</CustomTooltip>
|
||||
{/*chart pie icon for bussiness's dashboard */}
|
||||
{data?.role === "business" && (
|
||||
<CustomTooltip message="Dashboard">
|
||||
<Link href="/dashboard">
|
||||
<ChartPie />
|
||||
</Link>
|
||||
</CustomTooltip>
|
||||
)}
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="outline" size="icon" className="overflow-hidden rounded-full">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user