/*
 * @Author: zhoux zhouxia@supervision.ltd
 * @Date: 2023-11-01 13:56:33
 * @LastEditors: zhoux zhouxia@supervision.ltd
 * @LastEditTime: 2023-11-28 11:34:00
 * @FilePath: \general-ai-platform-web\src\components\RightContent\index.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { QuestionCircleOutlined } from '@ant-design/icons';
import { SelectLang as UmiSelectLang } from '@umijs/max';
import React from 'react';
import { Select } from 'antd';
import {useModel} from "@@/exports";
export type SiderTheme = 'light' | 'dark';
import {postUserSetUserRole} from "@/services/system/User";

export const SelectLang = () => {
  return (
    <UmiSelectLang
      style={{
        padding: 4,
      }}
    />
  );
};

export const Question = () => {
  return (
    <div
      style={{
        display: 'flex',
        height: 26,
      }}
      onClick={() => {
        window.open('https://pro.ant.design/docs/getting-started');
      }}
    >
      <QuestionCircleOutlined />
    </div>
  );
};

export const SelectRole = () => {

  const { initialState } = useModel('@@initialState');
  const { currentUser } = initialState || {};

  return (
    <span className='gn'>
      {
        currentUser && (
          <Select
            defaultValue={currentUser.roleId}
            options={currentUser?.roles || []}
            onSelect={value => {
              postUserSetUserRole({roleId: value}).then((resp) => {
                console.log(resp)
              })
            }}
          />
        )
      }
    </span>

  );
};
