Переглянути джерело

typescript resolve

master
azri 1 день тому
джерело
коміт
5e346fefe1

+ 1
- 1
app/guest/login/page.tsx Переглянути файл

@@ -1,5 +1,5 @@
1 1
 "use client";
2
-
2
+/* eslint-disable @typescript-eslint/no-explicit-any */
3 3
 import {
4 4
   Button,
5 5
   Checkbox,

+ 1
- 1
app/guest/signup/page.tsx Переглянути файл

@@ -1,5 +1,5 @@
1 1
 "use client";
2
-
2
+/* eslint-disable @typescript-eslint/no-explicit-any */
3 3
 import {
4 4
   Button,
5 5
   Form,

+ 2
- 16
app/layout.tsx Переглянути файл

@@ -1,23 +1,9 @@
1
+/* eslint-disable @typescript-eslint/no-explicit-any */
1 2
 import './globals.css'
2 3
 import type { Metadata } from 'next'
3
-
4 4
 import { ConfigProvider } from 'antd'
5
-import type { ThemeConfig } from 'antd';
6
-
7 5
 import QueryProvider from '@/components/general/QueryProvider';
8
-
9
-export const theme: ThemeConfig = {
10
-  token: {
11
-    colorPrimary: '#602FD0',
12
-    colorPrimary2: '#9E7DEA',
13
-    colorPrimary3: '#AD3B91',
14
-    colorSecondary: '#B3B3B3',
15
-    colorSuccess: '#35B37E',
16
-    colorWarning: '#FFAB00',
17
-    colorError: '#DB4336',
18
-    colorInfo: '#0165FF',
19
-  } as any,
20
-};
6
+import { theme } from '@/theme-config';
21 7
 
22 8
 export const metadata: Metadata = {
23 9
   title: 'Mobile App',

+ 2
- 2
app/user/chat/[chatID]/page.tsx Переглянути файл

@@ -1,7 +1,7 @@
1 1
 'use client';
2 2
 import { useState } from 'react';
3 3
 import type { Chat } from '@/types/chat';
4
-import { Flex, Layout, Row, Col, Input, Space, Upload, Button, Result } from 'antd';
4
+import { Flex, Layout, Row, Col, Input, Space, Upload, Button, Image } from 'antd';
5 5
 import PageTitle from '@/components/ui/PageTitle';
6 6
 import Navigation from '@/components/layout/Navigation'
7 7
 import { useParams } from 'next/navigation'
@@ -35,7 +35,7 @@ const ChatPage: React.FC = () => {
35 35
                         <PageTitle position='center' backButton={true}>{chat?.name}</PageTitle>
36 36
                         <div className="bg-white shadow p-4 flex flex-row border-b-2">
37 37
                             <div>
38
-                                <img
38
+                                <Image
39 39
                                     src="/default-avatar.png"
40 40
                                     alt="Profile"
41 41
                                     className="w-15 h-15 rounded-full object-cover border"

+ 0
- 1
app/user/chat/page.tsx Переглянути файл

@@ -18,7 +18,6 @@ const ChatPage: React.FC = () => {
18 18
     // Fetch chat data using React Query
19 19
     const {
20 20
         data: chatList = [],
21
-        error,
22 21
         isLoading,
23 22
     } = useQuery<Chat[] | undefined | null>({
24 23
         queryKey: ['getAllChat'],

+ 2
- 2
app/user/knowledge/create/page.tsx Переглянути файл

@@ -2,7 +2,7 @@
2 2
 
3 3
 import { useState, useEffect } from 'react'
4 4
 import PageTitle from '@/components/ui/PageTitle';
5
-import { Upload, Select, Switch, Form, Button, Tag, Layout, Typography, Input, Row, Col, Flex } from 'antd'
5
+import { Upload, Select, Switch, Form, Button, Tag, Typography, Input, Row, Col, Flex } from 'antd'
6 6
 import { UploadOutlined } from '@ant-design/icons';
7 7
 import InputList from '@/components/ui/InputList';
8 8
 import type { SelectProps } from 'antd';
@@ -16,7 +16,7 @@ const { Title, Text } = Typography;
16 16
 const CreatePersona: React.FC = () => {
17 17
 
18 18
     const [name, setName] = useState<string | undefined>("")
19
-    const [isPremium, setIsPremium] = useState<boolean>(true)
19
+    const [isPremium] = useState<boolean>(true)
20 20
     const [options, setOptions] = useState<SelectProps[] | undefined>()
21 21
     const [enabled, setEnabled] = useState({
22 22
         isWebSearch: false,

+ 7
- 5
app/user/knowledge/page.tsx Переглянути файл

@@ -16,6 +16,7 @@ import { Flex, Row, Col, Tag, Button, Table, Layout, Image, Typography } from 'a
16 16
 import type { ColumnsType } from 'antd/es/table';
17 17
 import { getAllKnowledge } from '@/app/api/user/knowledgeService';
18 18
 import LoadingScreen from '@/components/layout/LoadingScreen';
19
+import { Persona } from '@/types/persona';
19 20
 
20 21
 const { Text, Title } = Typography;
21 22
 
@@ -37,12 +38,13 @@ const columns: ColumnsType<Knowledge> = [
37 38
         ),
38 39
         dataIndex: 'personas',
39 40
         key: 'personas',
40
-        render: (_: any, record: Knowledge) => {
41
-            if (!record.personas?.length) return '-';
41
+        render: (record: Persona[]) => {
42
+
43
+            if (record.length === 0) return '-';
42 44
 
43 45
             return (
44 46
                 <Flex wrap>
45
-                    {record.personas.map((persona) => (
47
+                    {record.map((persona) => (
46 48
                         <Tag key={persona.id} color="blue">
47 49
                             {persona.name}
48 50
                         </Tag>
@@ -55,7 +57,7 @@ const columns: ColumnsType<Knowledge> = [
55 57
         title: 'Action',
56 58
         key: 'action',
57 59
         align: 'center' as const,
58
-        render: (_: any, record: Knowledge) => (
60
+        render: () => (
59 61
             <Flex justify="center">
60 62
                 <Button type="text" icon={<EditOutlined />} />
61 63
                 <Button type="text" icon={<EyeOutlined />} />
@@ -66,7 +68,7 @@ const columns: ColumnsType<Knowledge> = [
66 68
 
67 69
 const Knowledge: React.FC = () => {
68 70
 
69
-    const { data: knowledges, error, isLoading } = useQuery<Knowledge[]>({
71
+    const { data: knowledges, isLoading } = useQuery<Knowledge[]>({
70 72
         queryKey: ["getAllKnowledge"],
71 73
         queryFn: () => getAllKnowledge()
72 74
     })

+ 4
- 4
app/user/page.tsx Переглянути файл

@@ -1,7 +1,7 @@
1 1
 "use client";
2 2
 
3 3
 import React from 'react';
4
-import { Flex, Typography, Divider, Layout, Button, Row, Col, Image } from 'antd';
4
+import { Typography, Layout, Row, Col, Image } from 'antd';
5 5
 import { RightOutlined, PhoneOutlined } from '@ant-design/icons';
6 6
 import SectionTitle from '@/components/ui/SectionTitle';
7 7
 import PageTitle from '@/components/ui/PageTitle';
@@ -9,9 +9,9 @@ import LoadingMeter from '@/components/ui/LoadingMeter';
9 9
 import PrimaryButton from '@/components/ui/PrimaryButton';
10 10
 import { useRouter } from 'next/navigation';
11 11
 
12
-const { Title, Text } = Typography;
12
+const { Text } = Typography;
13 13
 
14
-const page = () => {
14
+const GuestPage = () => {
15 15
 
16 16
     const router = useRouter()
17 17
 
@@ -92,4 +92,4 @@ const page = () => {
92 92
     );
93 93
 };
94 94
 
95
-export default page;
95
+export default GuestPage;

+ 4
- 4
app/user/payment/page.tsx Переглянути файл

@@ -2,7 +2,7 @@
2 2
 
3 3
 import { useState } from 'react';
4 4
 import PageTitle from '@/components/ui/PageTitle';
5
-import { Typography, Button, Input, Form, Select, Switch, Flex, Row, Col } from 'antd';
5
+import { Typography, Input, Form, Select, Switch, Flex, Row, Col } from 'antd';
6 6
 import Link from 'next/link';
7 7
 
8 8
 import type { PaymentType } from '@/types/payment';
@@ -13,7 +13,7 @@ import PrimaryButton from '@/components/ui/PrimaryButton';
13 13
 import IconCard from '@/components/ui/IconCard';
14 14
 import LoadingScreen from '@/components/layout/LoadingScreen';
15 15
 
16
-const { Text, Title } = Typography;
16
+const { Text } = Typography;
17 17
 
18 18
 const CreatePersona: React.FC = () => {
19 19
   // Form states
@@ -24,7 +24,7 @@ const CreatePersona: React.FC = () => {
24 24
   const [cvc, setCvc] = useState('');
25 25
 
26 26
   // Fetch payment types using React Query
27
-  const { data: paymentType, error, isLoading } = useQuery<PaymentType[] | undefined>({
27
+  const { data: paymentType, isLoading } = useQuery<PaymentType[] | undefined>({
28 28
     queryKey: ['getPaymentType'],
29 29
     queryFn: getPaymentType
30 30
   });
@@ -47,7 +47,7 @@ const CreatePersona: React.FC = () => {
47 47
 
48 48
           {/* Payment type selection */}
49 49
           <Flex wrap gap={8}>
50
-            {paymentType?.map(({ id, type, description, icon_id }) => <IconCard key={id} active={selectedPaymentID === id} iconName={icon_id} text={description} handleClick={() => { setSelectedPaymentID(id)}} />)}
50
+            {paymentType?.map(({ id, description, icon_id }) => <IconCard key={id} active={selectedPaymentID === id} iconName={icon_id} text={description} handleClick={() => { setSelectedPaymentID(id)}} />)}
51 51
           </Flex>
52 52
 
53 53
           {/* Payment form */}

+ 3
- 3
app/user/payment/transaction-history/page.tsx Переглянути файл

@@ -10,7 +10,7 @@ import PaymentCard from '@/components/ui/PaymentCard';
10 10
 import AltLayout from '@/components/layout/AltLayout';
11 11
 import LoadingScreen from '@/components/layout/LoadingScreen';
12 12
 
13
-const { Text, Title } = Typography;
13
+const { Text } = Typography;
14 14
 
15 15
 const now = new Date();
16 16
 const month = now.toLocaleString('default', { month: 'long' });
@@ -19,7 +19,7 @@ const year = now.getFullYear().toString();
19 19
 const CreatePersona: React.FC = () => {
20 20
 
21 21
   // Fetch payment types using React Query
22
-  const { data: transactionList, error, isLoading } = useQuery<Transaction[] | undefined>({
22
+  const { data: transactionList, isLoading } = useQuery<Transaction[] | undefined>({
23 23
     queryKey: ['getAllTransaction'],
24 24
     queryFn: getAllTransaction
25 25
   });
@@ -46,7 +46,7 @@ const CreatePersona: React.FC = () => {
46 46
         </Col>
47 47
         <Col span={24}>
48 48
           <Flex vertical>
49
-            {transactionList?.map(({ name, created_at, amount }) => <PaymentCard name={name} created_at={created_at} amount={amount} />)}
49
+            {transactionList?.map(({ id, name, created_at, amount }) => <PaymentCard key={id} name={name} created_at={created_at} amount={amount} />)}
50 50
           </Flex>
51 51
         </Col>
52 52
       </Row>

+ 7
- 6
app/user/persona/create/page.tsx Переглянути файл

@@ -1,8 +1,9 @@
1 1
 "use client";
2
-
2
+/* eslint-disable @typescript-eslint/no-explicit-any */
3
+// i'm ignoring file list
3 4
 import { useState, useEffect } from 'react'
4 5
 import PageTitle from '@/components/ui/PageTitle';
5
-import { Input, Typography, Select, Switch, Upload, Form, Button, Tag, Col, Row, Flex } from 'antd'
6
+import { Input, Typography, Select, Switch, Upload, Form, Button, Tag, Col, Row, Flex, Image } from 'antd'
6 7
 import AltLayout from '@/components/layout/AltLayout';
7 8
 import { UploadOutlined } from '@ant-design/icons';
8 9
 import type { SelectProps } from 'antd';
@@ -14,7 +15,7 @@ import PhoneInput from 'react-phone-input-2';
14 15
 import 'react-phone-input-2/lib/style.css';
15 16
 import LoadingScreen from '@/components/layout/LoadingScreen';
16 17
 
17
-const { Text, Title } = Typography
18
+const { Text } = Typography
18 19
 
19 20
 const CreatePersona: React.FC = () => {
20 21
 
@@ -31,7 +32,7 @@ const CreatePersona: React.FC = () => {
31 32
         isSOPAutoLearn: false
32 33
     });
33 34
 
34
-    const { data: personaStyleList, error, isLoading } = useQuery({
35
+    const { data: personaStyleList, isLoading } = useQuery({
35 36
         queryKey: ["personaStyle"],
36 37
         queryFn: () => getPersonaStyle()
37 38
     })
@@ -104,10 +105,10 @@ const CreatePersona: React.FC = () => {
104 105
                                 </button>
105 106
                             </Upload>
106 107
                             {imageUrl && (
107
-                                <img
108
+                                <Image
108 109
                                     src={imageUrl}
109 110
                                     alt="Uploaded Preview"
110
-                                    className="mt-2 w-32 h-32 object-cover border rounded"
111
+                                    className="!mt-2 !w-32 !h-32 !object-cover !border !rounded"
111 112
                                 />
112 113
                             )}
113 114
                         </Form.Item>

+ 3
- 3
app/user/persona/page.tsx Переглянути файл

@@ -1,6 +1,6 @@
1 1
 'use client';
2 2
 
3
-import React, { useEffect, useState } from 'react';
3
+import React from 'react';
4 4
 import PageTitle from '@/components/ui/PageTitle';
5 5
 import {
6 6
     EyeOutlined,
@@ -57,7 +57,7 @@ const columns: ColumnsType<Persona> = [
57 57
         title: 'Action',
58 58
         key: 'action',
59 59
         align: 'center' as const,
60
-        render: (_: any, record: Persona) => (
60
+        render: () => (
61 61
             <Flex justify="center">
62 62
                 <Button type="text" icon={<EditOutlined />} />
63 63
                 <Button type="text" icon={<EyeOutlined />} />
@@ -70,7 +70,7 @@ const columns: ColumnsType<Persona> = [
70 70
 const PersonaPage: React.FC = () => {
71 71
 
72 72
 
73
-    const { data: personas, error, isLoading } = useQuery<Persona[]>({
73
+    const { data: personas, isLoading } = useQuery<Persona[]>({
74 74
         queryKey: ["getPersona"],
75 75
         queryFn: () => getPersona()
76 76
     })

+ 2
- 1
app/user/settings/profile/page.tsx Переглянути файл

@@ -15,6 +15,7 @@ import {
15 15
     Col,
16 16
     Divider,
17 17
     Flex,
18
+    Image
18 19
 } from 'antd';
19 20
 
20 21
 import AltLayout from '@/components/layout/AltLayout';
@@ -38,7 +39,7 @@ const ProfileSettings: React.FC = () => {
38 39
                             <Col span={24}>
39 40
                                 <Title level={5} className="!mb-3">Profile Photo</Title>
40 41
                                 <Flex vertical align="center" gap={16}>
41
-                                    <img
42
+                                    <Image
42 43
                                         src="/default-avatar.png"
43 44
                                         alt="Profile"
44 45
                                         className="w-20 h-20 rounded-full object-cover border"

+ 1
- 1
app/user/wallet/page.tsx Переглянути файл

@@ -16,7 +16,7 @@ import {
16 16
     Space,
17 17
 } from 'antd';
18 18
 
19
-const { Text, Title } = Typography;
19
+const { Text } = Typography;
20 20
 
21 21
 const Wallet: React.FC = () => {
22 22
     const [amount, setAmount] = useState('');

+ 3
- 4
components/layout/Header.tsx Переглянути файл

@@ -1,14 +1,13 @@
1 1
 'use client'
2 2
 
3 3
 import { useState } from 'react'
4
-import { MenuOutlined } from '@ant-design/icons'
5 4
 import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
6
-import { faBars, faBell } from '@fortawesome/free-solid-svg-icons'
7
-import { Button, Space, Image, Flex, Typography } from 'antd'
5
+import { faBars } from '@fortawesome/free-solid-svg-icons'
6
+import { Button, Image, Flex, Typography } from 'antd'
8 7
 import Sidebar from '@/components/layout/Sidebar'
9 8
 import BellNotification from '@/components/ui/BellNotification'
10 9
 
11
-const { Text, Title } = Typography
10
+const { Text } = Typography
12 11
 
13 12
 const Header = () => {
14 13
   const [showSideBar, setShowSideBar] = useState(false)

+ 1
- 2
components/layout/Sidebar.tsx Переглянути файл

@@ -1,8 +1,7 @@
1 1
 'use client'
2 2
 
3
-import { Drawer, Menu, Avatar, Typography, Image, Flex, Row, Col } from 'antd'
3
+import { Drawer, Menu, Typography, Image, Flex, Row, Col } from 'antd'
4 4
 import {
5
-  UserOutlined,
6 5
   LeftOutlined
7 6
 } from '@ant-design/icons'
8 7
 import { useRouter } from 'next/navigation'

+ 8
- 2
components/ui/IconCard.tsx Переглянути файл

@@ -1,10 +1,16 @@
1 1
 import React, { useCallback } from 'react'
2 2
 import { Typography } from 'antd';
3 3
 import { BankFilled, WalletFilled } from '@ant-design/icons';
4
+const { Text } = Typography
4 5
 
5
-const { Text, Title } = Typography
6
+type IconCardProps = {
7
+    active: boolean;
8
+    iconName: string;
9
+    text: string;
10
+    handleClick: () => void
11
+}
6 12
 
7
-const IconCard = ({ active, iconName, text, handleClick }) => {
13
+const IconCard: React.FC<IconCardProps> = ({ active, iconName, text, handleClick }: IconCardProps) => {
8 14
 
9 15
     const renderIcon = useCallback((nameId: string) => {
10 16
         if (nameId === "card") return <WalletFilled className='!text-white !text-xl' />

+ 2
- 2
components/ui/LoadingMeter.tsx Переглянути файл

@@ -1,7 +1,7 @@
1 1
 import React from 'react';
2
-import { Flex, Typography, Divider, Layout, Button, Row, Col, Image } from 'antd';
2
+import { Flex, Typography, Row, Col } from 'antd';
3 3
 
4
-const { Title, Text } = Typography;
4
+const { Text } = Typography;
5 5
 
6 6
 type LoadingMeterProps = {
7 7
     title: string,

+ 2
- 2
components/ui/PaymentCard.tsx Переглянути файл

@@ -1,9 +1,9 @@
1
-import React, { useState } from 'react';
1
+import React from 'react';
2 2
 import { Typography, Flex} from 'antd';
3 3
 import type { Transaction } from '@/types/payment';
4 4
 import formatDate from '@/helper/util/formatDateTime';
5 5
 
6
-const { Text, Title } = Typography;
6
+const { Text } = Typography;
7 7
 
8 8
 type PaymentCardProps = Omit<Transaction, 'id'>
9 9
 

+ 1
- 1
components/ui/PlanCard.tsx Переглянути файл

@@ -1,4 +1,4 @@
1
-import { Typography, Button, Row, Col, Card, Flex } from 'antd';
1
+import { Typography, Card, Flex } from 'antd';
2 2
 import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons';
3 3
 import PrimaryButton from './PrimaryButton';
4 4
 

+ 0
- 3
components/ui/PrimaryButton.tsx Переглянути файл

@@ -2,7 +2,6 @@
2 2
 
3 3
 import React from 'react';
4 4
 import { Button } from 'antd';
5
-import { useThemeToken } from '@/hooks/useThemeToken';
6 5
 import classNames from 'classnames';
7 6
 
8 7
 type PrimaryButtonProps = {
@@ -19,8 +18,6 @@ const PrimaryButton: React.FC<PrimaryButtonProps> = ({
19 18
     outline = false,
20 19
 }: PrimaryButtonProps) => {
21 20
 
22
-    const token = useThemeToken();
23
-
24 21
     const baseClasses = 'mt-2 !rounded-full !px-6 !py-4';
25 22
     const filledClasses = '!border-0 !bg-[#602FD0] !text-[#fff] hover:!bg-[#271550]';
26 23
     const outlineClasses = '!border !bg-[#fff] !text-[#602FD0] hover:!bg-[#602FD0] hover:!text-[#fff]';

+ 6
- 0
theme-config.ts Переглянути файл

@@ -0,0 +1,6 @@
1
+import type { ThemeConfig } from 'antd';
2
+export const theme: ThemeConfig = {
3
+  token: {
4
+    colorPrimary: '#602FD0',
5
+  },
6
+};

Завантаження…
Відмінити
Зберегти