Skip to content

Commit

Permalink
correct some erros
Browse files Browse the repository at this point in the history
  • Loading branch information
Afonso-santos committed Jul 11, 2023
1 parent 4eb3124 commit 4b32a2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 180 deletions.
144 changes: 6 additions & 138 deletions apps/app/components/Profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ import {
Row,
Space,
Tabs,
Tag,
Timeline,
Typography,
} from "antd";
import {
ClockCircleOutlined,
FontSizeOutlined,
UserOutlined,
} from "@ant-design/icons";
import { ClockCircleOutlined, UserOutlined } from "@ant-design/icons";

import moment from "moment";
import "moment/locale/pt";
Expand All @@ -24,19 +19,13 @@ import Document from "~/components/Document";
import * as api from "bokkenjs";
import * as socials from "~/lib/social";
import { notifyError, notifyInfo } from "~/components/Notification";
import styles from "./style.module.css";
import { EUser, getNinjasAsAdmin, updateGuardianAsAdmin } from "bokkenjs";

import { BsFileEarmarkPersonFill } from "react-icons/bs";
import Link from "next/link";

import { getIcon, getImg } from "~/lib/utils";
import Guardian from "pages/admin/guardians";
import { icons } from "react-icons";
import { getIcon } from "~/lib/utils";

const { TabPane } = Tabs;

const { Title, Text } = Typography;
const { Title } = Typography;

interface Props {
id: string;
Expand All @@ -49,8 +38,7 @@ function Profile({ id, role }: Props) {
const [projects, setProjects] = useState<any[]>([]);
const [skills, setSkills] = useState<any[]>([]);
const [date, setDate] = useState<string>("");
const [guardian, setGuardians] = useState<any[]>([]);
const [ninja, setNinja] = useState<any[]>([]);
const [guardian, setGuardians] = useState<any | null>([]);

useEffect(() => {
const fetchUserByRole = async () => {
Expand Down Expand Up @@ -135,8 +123,7 @@ function Profile({ id, role }: Props) {
api
.getGuardian(info.guardian_id)
.then((response: any) => setGuardians(response.data))
.catch((error: any) => {
});
.catch((error: any) => {});
}
}, [info.guardian_id, role]);
console.log(badges);
Expand Down Expand Up @@ -211,7 +198,7 @@ function Profile({ id, role }: Props) {
display: "inline-block",
fontSize: 20,
marginRight: "6px",
color:"#424549"
color: "#424549",
}}
key={s.id}
>
Expand Down Expand Up @@ -278,122 +265,3 @@ function Profile({ id, role }: Props) {
}

export default Profile;

{
/* <Row justify="center" align="middle">
<Space size="large">
<Avatar
size={{
xs: 100,
sm: 200,
md: 200,
lg: 200,
xl: 200,
xxl: 200,
}}
src={info?.photo}
icon={<UserOutlined />}
/>
<Row justify="center" align="middle">
<Col span={24}>
<Title level={2}>
{info.first_name} {info.last_name}
</Title>
</Col>
<Col span={24}>
<Title className={styles.capitalize} level={4}>
<BsFileEarmarkPersonFill />{role}
</Title>
</Col>
<Col span={24}>
<Title level={5}>Conta criada em: {date}</Title>
</Col>
{"belt" in info && (
<Col span={24}>
<Belt belt={info.belt} />
</Col>
)}
<Col span={24}>
<Space style={{ fontSize: 20 }}>
{info?.socials?.map((social: any) =>
social?.name == "discord" || social?.name == "slack" ? (
<a title={social.username}>
{socials.ICONS[social.name as keyof typeof socials.URLS]}
</a>
) : (
<a
key={social.id}
target="_blank"
rel="noreferrer"
href={`${
socials.URLS[social.name as keyof typeof socials.URLS]
}/${social.username}`}
>
{socials.ICONS[social.name as keyof typeof socials.URLS]}
</a>
)
)}
</Space>
</Col>
<Col span={24}>
{skills.map((s) => (
<Tag key={s.id}>
{getIcon(s.name)} {s.name}
</Tag>
))}
</Col>
</Row>
</Space>
</Row>
<Tabs defaultActiveKey="1" centered>
<TabPane tab="Eventos" key="1">
<Timeline mode="alternate">
<Timeline.Item dot={<ClockCircleOutlined />}>
Registou-se na plataforma{" "}
{moment(info.since).locale("pt").fromNow()}
</Timeline.Item>
</Timeline>
</TabPane>
{role === EUser.Ninja && (
<TabPane tab="Crachás" key="2">
{badges.length == 0 ? (
<Empty
description="Sem Crachás"
image={Empty.PRESENTED_IMAGE_SIMPLE}
/>
) : (
<Row justify="start" align="middle">
{badges.map((badge) => (
<Col key={badge.id} {...{ xs: 24, md: 12, xl: 8, xxl: 6 }}>
<Space>
<Badge {...badge} />
</Space>
</Col>
))}
</Row>
)}
</TabPane>
)}
<TabPane tab="Projetos" key="3">
{projects.length == 0 ? (
<Empty
description="Sem Projetos"
image={Empty.PRESENTED_IMAGE_SIMPLE}
/>
) : (
<Row justify="start" align="middle">
{projects.map((project) => (
<Col key={project.id} {...{ xs: 24, md: 12, xl: 8, xxl: 6 }}>
<Space>
<Document {...project} />
</Space>
</Col>
))}
</Row>
)}
</TabPane>
</Tabs> */
}
42 changes: 0 additions & 42 deletions apps/app/lib/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,45 +42,3 @@ export function getIcon(skill: string) {
return <SiSlack />;
}
}

export function getImg(skill: string) {
switch (skill) {
case "Python":
return (
<img
src="https://github.com/raw/devicons/devicon/master/icons/python/python-original.svg"
height="25"
width="25"
alt="Python Logo"
/>
);
case "Scratch":
return <SiScratch style={{ fontSize: "25px" }} />;
case "HTML/CSS/Javascript":
return (
<div style={{ display: "flex" }}>
<img
src="https://github.com/raw/devicons/devicon/master/icons/html5/html5-original.svg"
title="HTML"
alt="HTML"
width="25"
height="25"
/>
<img
src="https://github.com/raw/devicons/devicon/master/icons/css3/css3-original.svg"
title="CSS"
alt="CSS"
width="25"
height="25"
/>
<img
src="https://github.com/raw/devicons/devicon/master/icons/javascript/javascript-original.svg"
title="JavaScript"
alt="JavaScript"
width="25"
height="25"
/>
</div>
);
}
}

0 comments on commit 4b32a2a

Please sign in to comment.