import React, { useState } from "react";
import { SettingOutlined, QuestionCircleOutlined, LogoutOutlined, RightOutlined } from '@ant-design/icons';
import { Layout, Menu, theme, Button, Modal, MenuProps } from 'antd';
import { Dropdown, Space } from 'antd';
import '../../public/assets/left_side_nav.css';
import '../../public/assets/knowledge-quest.css';
const { Content, Sider } = Layout;

const items: MenuProps['items'] = [
    {
        label: <a href="https://www.antgroup.com">1st menu item</a>,
        key: '01sd',
    },
    {
        type: 'divider',
    },
    {
        label: <a href="https://www.aliyun.com">2nd menu item</a>,
        key: '02sd',
    },
    {
        type: 'divider',
    },
    {
        label: '3rd menu item',
        key: '03sd',
    },
];

const App: React.FC = () => {
    const [collapsed, setCollapsed] = useState(false);
    const [open, setOpen] = React.useState<boolean>(false);
    const [loading, setLoading] = React.useState<boolean>(true);

    const showLoading = () => {
        setOpen(true);
        setLoading(true);

        // Simple loading mock. You should add cleanup logic in real world.
        setTimeout(() => {
            setLoading(false);
        }, 100);
    };
    const { token: { colorBgContainer }, } = theme.useToken();
    return (
        <div>
            <Modal style={{ top: '20px', right: '0px' }} title={<p>Loading Modal</p>} footer={<Button type="primary" onClick={showLoading}> Reload </Button>} loading={loading} open={open} onCancel={() => setOpen(false)} >
                <p>Some contents...</p>
                <p>Some contents...</p>
                <p>Some contents...</p>
            </Modal>
            <div className='border-b-[1px] py-2 border-[#CFCFCF]'>
                <div className='container mx-auto flex flex-row justify-between'>
                    <div className='inline-flex justify-center place-items-center'>
                        <img src="../../assets/student-dash.svg" alt="" />
                        <p className='pl-1 text-[18px] font-[700] whitespace-nowrap'>Student Dashboard</p>
                    </div>
                    <div className="flex items-center">
                        <Button className='border-none shadow-none bg-transparent hover:bg-transparent' onClick={showLoading}>
                            <div className='border-[1px] border[#525252] rounded-full p-2 w-[47px] h-[47px]'>
                                <svg viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
                                    <path d="M5.06445 20.2658V18.2111H7.1191V11.0198C7.1191 9.59872 7.54715 8.33597 8.40325 7.2316C9.25935 6.12723 10.3723 5.40382 11.742 5.06138V4.34225C11.742 3.9142 11.8919 3.55036 12.1915 3.25072C12.4911 2.95109 12.855 2.80127 13.283 2.80127C13.7111 2.80127 14.0749 2.95109 14.3746 3.25072C14.6742 3.55036 14.824 3.9142 14.824 4.34225V5.06138C16.1938 5.40382 17.3067 6.12723 18.1628 7.2316C19.0189 8.33597 19.447 9.59872 19.447 11.0198V18.2111H21.5016V20.2658H5.06445ZM13.283 23.3477C12.718 23.3477 12.2343 23.1465 11.8319 22.7442C11.4296 22.3418 11.2284 21.8581 11.2284 21.2931H15.3377C15.3377 21.8581 15.1365 22.3418 14.7341 22.7442C14.3318 23.1465 13.8481 23.3477 13.283 23.3477ZM9.17374 18.2111H17.3923V11.0198C17.3923 9.88979 16.99 8.9224 16.1852 8.11766C15.3805 7.31293 14.4131 6.91056 13.283 6.91056C12.153 6.91056 11.1856 7.31293 10.3808 8.11766C9.57611 8.9224 9.17374 9.88979 9.17374 11.0198V18.2111Z" fill="black" />
                                    <circle cx="19.4462" cy="19.2384" r="4.23771" fill="#FF0000" stroke="#fff" strokeWidth="2.31148" />
                                </svg>
                            </div>
                        </Button>
                        <Dropdown menu={{ items }} trigger={['click']}>
                            <a onClick={(e) => e.preventDefault()}>
                                <Space>
                                    <div className='flex flex-row border-[1px] border-[#BBBBBB] rounded-full p-1 gap-x-6'>
                                        <img src="/assets/man.png" alt="" />
                                        <div>
                                            <p className='text-[12px] text-[#EF7A0C] font-[500]'>My Profile</p>
                                            <p className='text-[16px] text-[#27549F] font-[700]'>Rayan Holiday</p>
                                        </div>
                                        <RightOutlined style={{ fontSize: '12px', paddingRight: '10px' }} />
                                    </div>
                                </Space>
                            </a>
                        </Dropdown>
                    </div>
                </div>
            </div>
        </div>
    )
}

export default App;