mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-19 05:54: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: |
|
path: |
|
||||||
~/.npm
|
~/.npm
|
||||||
${{ github.workspace }}/.next/cache
|
${{ 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: |
|
restore-keys: |
|
||||||
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
|
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
if: steps.ci-cache.outputs.cache-hit != 'true'
|
if: steps.ci-cache.outputs.cache-hit != 'true'
|
||||||
|
|
||||||
- name: Run build
|
- 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 { useEffect, useState } from "react";
|
||||||
import { SubmitHandler, useForm } from "react-hook-form";
|
import { SubmitHandler, useForm } from "react-hook-form";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
|||||||
@ -10,12 +10,13 @@ import { getCurrentUserID } from "@/app/api/userApi";
|
|||||||
import { uploadFile } from "@/app/api/generalApi";
|
import { uploadFile } from "@/app/api/generalApi";
|
||||||
import { Loader } from "@/components/loading/loader";
|
import { Loader } from "@/components/loading/loader";
|
||||||
import { hasUserApplied, transformChoice } from "./actions";
|
import { hasUserApplied, transformChoice } from "./actions";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
type businessSchema = z.infer<typeof businessFormSchema>;
|
type businessSchema = z.infer<typeof businessFormSchema>;
|
||||||
const BUCKET_PITCH_NAME = "business-application";
|
const BUCKET_PITCH_NAME = "business-application";
|
||||||
let supabase = createSupabaseClient();
|
let supabase = createSupabaseClient();
|
||||||
|
|
||||||
export default function ApplyBusiness() {
|
export default function ApplyBusiness() {
|
||||||
|
const router = useRouter();
|
||||||
const alertShownRef = useRef(false);
|
const alertShownRef = useRef(false);
|
||||||
const [success, setSucess] = useState(false);
|
const [success, setSucess] = useState(false);
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ export default function ApplyBusiness() {
|
|||||||
text: error == null ? "Your application has been submitted" : error.message,
|
text: error == null ? "Your application has been submitted" : error.message,
|
||||||
confirmButtonColor: error == null ? "green" : "red",
|
confirmButtonColor: error == null ? "green" : "red",
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
window.location.href = "/";
|
router.push("/");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ export default function ApplyBusiness() {
|
|||||||
allowEscapeKey: false,
|
allowEscapeKey: false,
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
window.location.href = "/";
|
router.push("/");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -112,6 +113,7 @@ export default function ApplyBusiness() {
|
|||||||
};
|
};
|
||||||
// setSucess(true);
|
// setSucess(true);
|
||||||
fetchUserData();
|
fetchUserData();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -15,9 +15,11 @@ import { useQuery } from "@supabase-cache-helpers/postgrest-react-query";
|
|||||||
import { overAllGraphData, fourYearGraphData, dayOftheWeekData } from "../portfolio/[uid]/query";
|
import { overAllGraphData, fourYearGraphData, dayOftheWeekData } from "../portfolio/[uid]/query";
|
||||||
import CountUp from "react-countup";
|
import CountUp from "react-countup";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
const supabase = createSupabaseClient();
|
const supabase = createSupabaseClient();
|
||||||
|
const router = useRouter();
|
||||||
const { session, loading: isLoadingSession } = useSession();
|
const { session, loading: isLoadingSession } = useSession();
|
||||||
const userId = session?.user.id;
|
const userId = session?.user.id;
|
||||||
const [projects, setProjects] = useState<
|
const [projects, setProjects] = useState<
|
||||||
@ -234,7 +236,7 @@ export default function Dashboard() {
|
|||||||
</Card>
|
</Card>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
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"
|
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;}[]
|
deals: { project_id: number; deal_amount: number; created_time: Date;}[]
|
||||||
) {
|
) {
|
||||||
const llist = [];
|
const llist = [];
|
||||||
const count = 8;
|
const count = 5;
|
||||||
// select project name from the given id
|
// select project name from the given id
|
||||||
for (let i = deals.length - 1; i >= 0 && llist.length < count; --i) {
|
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);
|
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,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
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 { LogoutButton } from "@/components/auth/logoutButton";
|
||||||
import { useUserRole } from "@/hooks/useUserRole";
|
import { useUserRole } from "@/hooks/useUserRole";
|
||||||
|
import CustomTooltip from "../customToolTip";
|
||||||
|
|
||||||
interface AuthenticatedComponentsProps {
|
interface AuthenticatedComponentsProps {
|
||||||
uid: string;
|
uid: string;
|
||||||
@ -28,22 +29,36 @@ export const AuthenticatedComponents = ({ uid, avatarUrl, notificationCount }: A
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`flex gap-3 pl-2 items-center ${businessClass}`}>
|
<div className={`flex gap-3 pl-2 items-center ${businessClass}`}>
|
||||||
<Link href={"/notification"}>
|
<CustomTooltip message="Notification">
|
||||||
<div className="relative inline-block">
|
<Link href={"/notification"}>
|
||||||
<Bell className="h-6 w-6 " />
|
<div className="relative inline-block">
|
||||||
{notificationCount >= 1 && (
|
<Bell className="h-6 w-6 " />
|
||||||
<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 >= 1 && (
|
||||||
{notificationCount}
|
<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">
|
||||||
</span>
|
{notificationCount}
|
||||||
)}
|
</span>
|
||||||
</div>
|
)}
|
||||||
</Link>
|
</div>
|
||||||
<Link href="/follow">
|
</Link>
|
||||||
<Heart />
|
</CustomTooltip>
|
||||||
</Link>
|
<CustomTooltip message="Followed">
|
||||||
<Link href={"/portfolio/" + uid}>
|
<Link href="/follow">
|
||||||
<Wallet className="cursor-pointer" />
|
<Heart />
|
||||||
</Link>
|
</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>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button variant="outline" size="icon" className="overflow-hidden rounded-full">
|
<Button variant="outline" size="icon" className="overflow-hidden rounded-full">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user