Skip to content

Commit

Permalink
fixed few more
Browse files Browse the repository at this point in the history
  • Loading branch information
amanbairagi30 committed Aug 19, 2024
1 parent 5f79633 commit f72496d
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 54 deletions.
Binary file removed public/fonts/Satoshi-Bold.otf
Binary file not shown.
Binary file removed public/fonts/Satoshi-Medium.otf
Binary file not shown.
Binary file removed public/fonts/Satoshi-Medium.woff2
Binary file not shown.
Binary file removed public/fonts/Satoshi-Regular.otf
Binary file not shown.
8 changes: 2 additions & 6 deletions src/app/MainProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import React, { ReactNode } from 'react';
import { Appbar } from '@/components/Appbar';
import MainSidebar from '@/components/MainSidebar';
import { mainSideBarToggle } from '@/store/atoms/mainSidebar';
import { useRecoilState, useRecoilValue } from 'recoil';
import { useRecoilState } from 'recoil';
import { useSession } from 'next-auth/react';
// import Topbar from '@/components/Topbar'


export default function MainProvider({ children }: { children: ReactNode }) {
const { data: session, status: sessionStatus } = useSession();
const isLoading = sessionStatus === 'loading';
Expand All @@ -18,7 +17,6 @@ export default function MainProvider({ children }: { children: ReactNode }) {
<div className='border-red-500 h-screen'>
{/* <div className="min-h-[calc(100vh-64px)]">{children}</div> */}


<div className='flex w-full h-full'>
{!isMainSideBarCompressed && (
<div
Expand All @@ -36,9 +34,7 @@ export default function MainProvider({ children }: { children: ReactNode }) {
</div>
</div>
</div>


</div>
</div>
)
);
}
30 changes: 15 additions & 15 deletions src/app/payout-methods/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,51 @@ export default function Page() {

const closeDialog = () => setIsDialogBoxOpen(false);

const [upiAddresses, setUpiAddresses] = useState<UpiId[] | undefined>([])
const [solanaAddresses, setSolanaAddresses] = useState<SolanaAddress[] | undefined>([])
const [upiAddresses, setUpiAddresses] = useState<UpiId[] | undefined>([]);
const [solanaAddresses, setSolanaAddresses] = useState<SolanaAddress[] | undefined>([]);

const fetchPayoutMethods = async () => {
const result = await getPayoutMethods()
const result = await getPayoutMethods();
if (result) {
setUpiAddresses(result.upiIds)
setSolanaAddresses(result.solanaAddresses)
setUpiAddresses(result.upiIds);
setSolanaAddresses(result.solanaAddresses);
}
}

const { execute: executeDeleteUPI } = useAction(deleteUpiId, {
onSuccess: () => {
toast.success("UPI Address deleted successfully")
toast.success("UPI Address deleted successfully");
},
onError: () => {
toast.error("Failed to delete UPI id")
toast.error("Failed to delete UPI id");
}
})

const { execute: executeDeleteSolana } = useAction(deleteSolanaAddress, {
onSuccess: () => {
toast.success("Solana Address deleted successfully")
toast.success("Solana Address deleted successfully");
},
onError: () => {
toast.error("Failed to delete Solana address")
toast.error("Failed to delete Solana address");
}
})

const handleUpiDelete = (id: number) => {
executeDeleteUPI({ id: id })
fetchPayoutMethods()
executeDeleteUPI({ id: id });
fetchPayoutMethods();
}

const handleSolanaDelete = (id: number) => {
executeDeleteSolana({ id: id })
fetchPayoutMethods()
executeDeleteSolana({ id: id });
fetchPayoutMethods();
}

useEffect(() => {
fetchPayoutMethods()
fetchPayoutMethods();
}, [])

useEffect(() => {
fetchPayoutMethods()
fetchPayoutMethods();
}, [isDialogBoxOpen])

return (
Expand Down
6 changes: 3 additions & 3 deletions src/components/Appbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AppbarAuth } from './AppbarAuth';
import { useSession } from 'next-auth/react';
import { useRecoilState } from 'recoil';
import { sidebarOpen as sidebarOpenAtom } from '../store/atoms/sidebar';
import { ToggleButton } from './Sidebar';
// import { ToggleButton } from './Sidebar';
import { usePathname } from 'next/navigation';
import Logo from './landing/logo/logo';
import { Button } from './ui/button';
Expand All @@ -19,8 +19,8 @@ import { mainSideBarToggle } from '@/store/atoms/mainSidebar';

export const Appbar = () => {
const { data: session, status: sessionStatus } = useSession();
const [sidebarOpen, setSidebarOpen] = useRecoilState(sidebarOpenAtom);
const currentPath = usePathname();
// const [sidebarOpen, setSidebarOpen] = useRecoilState(sidebarOpenAtom);
// const currentPath = usePathname();

const [isMainSideBarCompressed, setIsMainSideBarCompressed] = useRecoilState(mainSideBarToggle);

Expand Down
10 changes: 5 additions & 5 deletions src/components/CircularProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const chartConfig = {

export function CircularProgressBar({ percentage = 91 }) {
// Ensure percentage is between 0 and 100
const safePercentage = Math.min(Math.max(percentage, 0), 100)
const endAngle = (safePercentage / 100) * 450
const safePercentage = Math.min(Math.max(percentage, 0), 100);
const endAngle = (safePercentage / 100) * 450;

const chartData = [
{ percentage: safePercentage, fill: "#fff" },
]
];

return (
<div className="flex flex-col items-center">
Expand Down Expand Up @@ -79,13 +79,13 @@ export function CircularProgressBar({ percentage = 91 }) {
{`${safePercentage}%`}
</tspan>
</text>
)
);
}
}}
/>
</PolarRadiusAxis>
</RadialBarChart>
</ChartContainer>
</div>
)
);
}
5 changes: 2 additions & 3 deletions src/components/CourseCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';
import { Course } from '@/store/atoms';
import PercentageComplete from './PercentageComplete';
// import PercentageComplete from './PercentageComplete';
import { SecondaryButton } from './buttons/SecondaryButton';
import { useRouter } from 'next/navigation';
import Link from 'next/link';
Expand Down Expand Up @@ -34,7 +34,7 @@ export const CourseCard = ({
return 0;
}
return Math.ceil((course.totalVideosWatched / course.totalVideos) * 100);
}
};

return (
<div
Expand Down Expand Up @@ -63,7 +63,6 @@ export const CourseCard = ({
<div className="font-semibold flex-1 text-xl">{course.title} Cohort</div>
</div>


<div className='mb-4 flex flex-col gap-2'>
<p className='text-[#94A3B8] text-sm flex items-center justify-end'>{generateProgressPercentage()}%</p>
<Progress className='h-[0.5rem]' value={generateProgressPercentage()} />
Expand Down
2 changes: 1 addition & 1 deletion src/components/CourseView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getFolderPercentCompleted } from '@/lib/utils';
import Comments from './comment/Comments';
import { QueryParams } from '@/actions/types';
import BreadCrumbComponent from './BreadCrumbComponent';
import { usePathname } from 'next/navigation';
// import { usePathname } from 'next/navigation';
import SidebarToggle from './SidebarToggle';

export const CourseView = ({
Expand Down
1 change: 0 additions & 1 deletion src/components/FolderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export const FolderView = ({
const sidebarOpen = useRecoilValue(sidebarOpenAtom);
const isMainSideBarCompressed = useRecoilValue(mainSideBarToggle);


return (
<div>
<div></div>
Expand Down
16 changes: 7 additions & 9 deletions src/components/MainSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export default function MainSidebar() {
general: null,
others: null
});
const router = useRouter();
// const router = useRouter();
const session = useSession();
const user = session?.data?.user;
// const user = session?.data?.user;

const [isMainSideBarCompressed, setIsMainSideBarCompressed] = useRecoilState(mainSideBarToggle);

Expand Down Expand Up @@ -88,7 +88,7 @@ export default function MainSidebar() {
href: "/logout",
},
]
}
};

const ToggleIcon = isMainSideBarCompressed ? PanelLeftOpen : PanelRightOpen;

Expand Down Expand Up @@ -122,7 +122,7 @@ export default function MainSidebar() {
</TooltipContent>
</Tooltip>
</TooltipProvider>
)
);
}
)
}
Expand All @@ -148,7 +148,7 @@ ${isMainSideBarCompressed ? 'w-0 opacity-0' : 'w-auto opacity-100'}`}>{x.name}</
</TooltipContent>
</Tooltip>
</TooltipProvider>
)
);
}
return (
<>
Expand All @@ -169,14 +169,12 @@ ${isMainSideBarCompressed ? 'w-0 opacity-0' : 'w-auto opacity-100'}`}>{x.name}</
</Tooltip>
</TooltipProvider>
</>
)
);
})}
</div>
</div>


</div>
</div>
</div>
)
);
}
8 changes: 4 additions & 4 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use client';
import { usePathname, useRouter } from 'next/navigation';
import { usePathname } from 'next/navigation';
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from '@/components/ui/accordion';
import { FullCourseContent } from '@/db/course';
import { Button } from './ui/button';
import { BackArrow } from '@/icons/BackArrow';
// import { Button } from './ui/button';
// import { BackArrow } from '@/icons/BackArrow';
import { useRecoilState } from 'recoil';
import { sidebarOpen as sidebarOpenAtom } from '@/store/atoms/sidebar';
import { useEffect, useState } from 'react';
Expand All @@ -26,7 +26,7 @@ export function Sidebar({
}) {
const pathName = usePathname();

const [isSmallerScreen, setIsSmallerScreen] = useState<boolean>(false)
const [isSmallerScreen, setIsSmallerScreen] = useState<boolean>(false);

const [sidebarOpen, setSidebarOpen] = useRecoilState(sidebarOpenAtom);
const [currentActiveContentIds, setCurrentActiveContentIds] = useState<
Expand Down
2 changes: 1 addition & 1 deletion src/components/SidebarToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ export default function SidebarToggle() {
</Button>
)}
</div>
)
);
}
12 changes: 6 additions & 6 deletions src/components/profile-menu/ProfileDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import Link from 'next/link';
import {
BookmarkIcon,
HistoryIcon,
LogOutIcon,
// BookmarkIcon,
// HistoryIcon,
// LogOutIcon,
User2Icon,
Bird,
// Bird,
CreditCard
} from 'lucide-react';
import {
Expand All @@ -18,8 +18,8 @@ import {
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import ExternalLinks from './ExternalLinks';
import { signOut } from 'next-auth/react';
import { SelectTheme } from './SelectTheme';
// import { signOut } from 'next-auth/react';
// import { SelectTheme } from './SelectTheme';

const ProfileDropdown = () => {
const menuItemLinks = [
Expand Down

0 comments on commit f72496d

Please sign in to comment.