Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Topic Delection Bug #28

Merged
merged 3 commits into from
Mar 6, 2024
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
26 changes: 19 additions & 7 deletions audire/audire-dashboard/modules/course-topics/TopicListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import {
TableHeader,
TableRow,
Tooltip,
useDisclosure
useDisclosure,
} from '@nextui-org/react';
import React, { useState } from 'react';
import { CiEdit } from 'react-icons/ci';
import { IoMdAdd } from 'react-icons/io';
import { MdDelete } from 'react-icons/md';
import { columns } from './data';
// import TopicForm from './TopicForm';
import { Zoom, toast } from 'react-toastify';
import {
TopicWithNumQuestions,
useTopicDelete,
Expand All @@ -33,7 +33,9 @@ const TopicListView: FC = () => {
undefined
);
const [stageId, setSelectedStage] = useState<string | undefined>(undefined);
const [activeTopic, setActiveTopic] = useState<TopicWithNumQuestions | null>(null);
const [activeTopic, setActiveTopic] = useState<TopicWithNumQuestions | null>(
null
);

const {
data: { data: topics } = {
Expand Down Expand Up @@ -85,9 +87,7 @@ const TopicListView: FC = () => {
case 'mcqQuestion':
return (
<Chip className="capitalize" size="sm" variant="flat">
{topic.numQuestion > 0
? `✅ ${topic.numQuestion} MCQs`
: '❌'}
{topic.numQuestion > 0 ? `✅ ${topic.numQuestion} MCQs` : '❌'}
</Chip>
);

Expand Down Expand Up @@ -149,11 +149,23 @@ const TopicListView: FC = () => {
})
.catch((error) => {
console.error('Delete error:', error);
if (error.code === '23503') {
toast.error('Please delete the contents in this topic', {
position: 'bottom-center',
autoClose: 3000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: 'colored',
transition: Zoom,
});
}
});
}
}}
/>
{/* <TopicForm isOpen={isOpen} onOpenChange={onOpenChange} /> */}
<div className="flex items-center justify-between ">
<h1 className=" text-2xl font-bold">Topics</h1>

Expand Down
4 changes: 2 additions & 2 deletions audire/audire-dashboard/modules/login/LoginView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useRouter } from 'next/router';

const LoginFormSchema = z.object({
email: z.string().email(),
password: z.string().min(8, 'Password must be at least 8 characters long'),
password: z.string(),
});

type LoginForm = z.infer<typeof LoginFormSchema>;
Expand Down Expand Up @@ -75,7 +75,7 @@ const LoginView: FC = () => {
className="block mt-6"
name="password"
placeholder="Enter your password"
type='password'
type="password"
/>

<Button
Expand Down
3 changes: 3 additions & 0 deletions libs/supabase/supabase/functions/_shared/fast2sms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export async function sendOTP(mobile: string, otp: string): Promise<boolean> {
return false;
}

console.info('Sending OTP', mobile, otp);
return true;

const apiKey = Deno.env.get('FAST2SMS_API_KEY');

const res = await fetch('https://www.fast2sms.com/dev/bulkV2', {
Expand Down
Loading