After Width: | Height: | Size: 747 B |
After Width: | Height: | Size: 3.2 KiB |
@ -1,13 +0,0 @@
|
||||
:root {
|
||||
--main-color: #ffffff;
|
||||
--second-color: #ccde54;
|
||||
|
||||
--background-color: #d2cdd3;
|
||||
|
||||
--selected-team-primarycolor: #ffffff;
|
||||
--selected-team-secondarycolor: #000000;
|
||||
|
||||
--selection-color: #3f7fc4;
|
||||
|
||||
--arrows-color: #676767;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
@import url(../theme/dark.css);
|
||||
@import url(personnal_space.css);
|
||||
@import url(side_menu.css);
|
||||
@import url(../template/header.css);
|
||||
|
||||
body {
|
||||
/* background-color: #303030; */
|
||||
}
|
||||
#main {
|
||||
/* margin-left : 10%;
|
||||
margin-right: 10%; */
|
||||
/* border : solid 1px #303030; */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-family: var(--font-content);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#body {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin: 0px;
|
||||
height: 100%;
|
||||
background-color: var(--second-color);
|
||||
}
|
||||
|
||||
.data {
|
||||
border: 1.5px solid var(--main-contrast-color);
|
||||
background-color: var(--main-color);
|
||||
border-radius: 0.75cap;
|
||||
color: var(--main-contrast-color);
|
||||
}
|
||||
|
||||
.data:hover {
|
||||
border-color: var(--accent-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.set-button {
|
||||
width: 80%;
|
||||
margin-left: 5%;
|
||||
margin-top: 5%;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
#personal-space {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#title-personal-space h2 {
|
||||
text-align: center;
|
||||
color: var(--main-contrast-color);
|
||||
/* font-family: Helvetica;
|
||||
font-weight: bold; */
|
||||
}
|
||||
|
||||
#body-personal-space {
|
||||
width: 95%;
|
||||
/* background-color: #ccc2b7; */
|
||||
border: 3px var(--main-color) solid;
|
||||
border-radius: 0.5cap;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
#body-personal-space table {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 1em;
|
||||
table-layout: fixed;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#body-personal-space td {
|
||||
width: 80px !important;
|
||||
padding-bottom: 1%;
|
||||
padding-top: 1%;
|
||||
height: fit-content;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
tbody p {
|
||||
text-align: center;
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
@import url(../theme/dark.css);
|
||||
|
||||
#side-menu {
|
||||
background-color: var(--third-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#side-menu h2 {
|
||||
display: inline-block;
|
||||
margin-right: 5%;
|
||||
}
|
||||
|
||||
#side-menu-content {
|
||||
width: 90%;
|
||||
}
|
||||
.titre-side-menu {
|
||||
border-bottom: var(--main-color) solid 3px;
|
||||
width: 100%;
|
||||
margin-bottom: 3%;
|
||||
}
|
||||
|
||||
#side-menu .title {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: var(--main-contrast-color);
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
background-color: var(--main-color);
|
||||
padding: 3%;
|
||||
margin-bottom: 0px;
|
||||
margin-right: 3%;
|
||||
}
|
||||
|
||||
.new {
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
.button-side-menu {
|
||||
/* border : black solid 1px; */
|
||||
border-radius: 0.5cap;
|
||||
width: fit-content;
|
||||
padding: 2%;
|
||||
margin-top: 3%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.button-side-menu:hover {
|
||||
/* background-color: #c9d1e0; */
|
||||
cursor: pointer;
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
#header {
|
||||
text-align: center;
|
||||
background-color: var(--main-color);
|
||||
margin: 0px;
|
||||
/* border : var(--accent-color) 1px solid; */
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
font-family: var(--font-title);
|
||||
/* border-radius: 0.75cap; */
|
||||
}
|
||||
|
||||
#img-account {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#header-right,
|
||||
#header-left {
|
||||
width: 10%;
|
||||
/* border: yellow 2px solid; */
|
||||
}
|
||||
|
||||
#header-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#username {
|
||||
color: var(--main-contrast-color);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#clickable-header-right:hover #username {
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
#header-center {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
#clickable-header-right {
|
||||
width: 40%;
|
||||
border-radius: 1cap;
|
||||
padding: 2%;
|
||||
}
|
||||
|
||||
#clickable-header-right:hover {
|
||||
border: orange 1px solid;
|
||||
}
|
||||
|
||||
.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#img-account {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#iqball {
|
||||
color: var(--accent-color);
|
||||
font-weight: bold;
|
||||
font-size: 45px;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
:root {
|
||||
--main-color: #191a21;
|
||||
--second-color: #282a36;
|
||||
--third-color: #303341;
|
||||
--accent-color: #ffa238;
|
||||
--main-contrast-color: #e6edf3;
|
||||
--font-title: Helvetica;
|
||||
--font-content: Helvetica;
|
||||
}
|
@ -0,0 +1,267 @@
|
|||||||
import "../style/home/home.css"
|
|||||||
|
|||||||
// import AccountSvg from "../assets/account.svg?react"
|
|||||||
import { CSSProperties, useRef } from "react"
|
|||||||
import { Header } from "./template/Header"
|
|||||||
|
|||||||
interface Tactic {
|
|||||||
id: number
|
|||||||
name: string
|
|||||||
creation_date: string
|
|||||||
}
|
|||||||
|
|||||||
interface Team {
|
|||||||
id: number
|
|||||||
name: string
|
|||||||
picture: string
|
|||||||
main_color: string
|
|||||||
second_color: string
|
|||||||
}
|
|||||||
|
|||||||
export default function Home({
|
|||||||
yanis.dahmane-bounoua marked this conversation as resolved
|
|||||||
lastTactics,
|
|||||||
allTactics,
|
|||||||
teams,
|
|||||||
username,
|
|||||||
}: {
|
|||||||
lastTactics: Tactic[]
|
|||||||
allTactics: Tactic[]
|
|||||||
teams: Team[]
|
|||||||
username: string
|
|||||||
}) {
|
|||||||
return (
|
|||||||
<div id="main">
|
|||||||
<Header username={username} />
|
|||||||
<Body
|
|||||||
lastTactics={lastTactics}
|
|||||||
allTactics={allTactics}
|
|||||||
teams={teams}
|
|||||||
/>
|
|||||||
</div>
|
|||||||
)
|
|||||||
}
|
|||||||
|
|||||||
function Body({
|
|||||||
lastTactics,
|
|||||||
allTactics,
|
|||||||
teams,
|
|||||||
}: {
|
|||||||
lastTactics: Tactic[]
|
|||||||
allTactics: Tactic[]
|
|||||||
teams: Team[]
|
|||||||
}) {
|
|||||||
const widthPersonalSpace = 78
|
|||||||
const widthSideMenu = 100 - widthPersonalSpace
|
|||||||
return (
|
|||||||
<div id="body">
|
|||||||
<PersonalSpace width={widthPersonalSpace} allTactics={allTactics} />
|
|||||||
<SideMenu
|
|||||||
width={widthSideMenu}
|
|||||||
lastTactics={lastTactics}
|
|||||||
teams={teams}
|
|||||||
/>
|
|||||||
</div>
|
|||||||
)
|
|||||||
}
|
|||||||
|
|||||||
function SideMenu({
|
|||||||
width,
|
|||||||
lastTactics,
|
|||||||
teams,
|
|||||||
}: {
|
|||||||
width: number
|
|||||||
lastTactics: Tactic[]
|
|||||||
teams: Team[]
|
|||||||
}) {
|
|||||||
return (
|
|||||||
<div
|
|||||||
id="side-menu"
|
|||||||
style={{
|
|||||||
width: width + "%",
|
|||||||
}}>
|
|||||||
<div id="side-menu-content">
|
|||||||
<Team teams={teams} />
|
|||||||
<Tactic lastTactics={lastTactics} />
|
|||||||
</div>
|
|||||||
</div>
|
|||||||
)
|
|||||||
}
|
|||||||
|
|||||||
function PersonalSpace({
|
|||||||
width,
|
|||||||
allTactics,
|
|||||||
}: {
|
|||||||
width: number
|
|||||||
allTactics: Tactic[]
|
|||||||
}) {
|
|||||||
return (
|
|||||||
<div
|
|||||||
id="personal-space"
|
|||||||
style={{
|
|||||||
width: width + "%",
|
|||||||
}}>
|
|||||||
<TitlePersonalSpace />
|
|||||||
<BodyPersonalSpace allTactics={allTactics} />
|
|||||||
</div>
|
|||||||
)
|
|||||||
}
|
|||||||
|
|||||||
function TitlePersonalSpace() {
|
|||||||
return (
|
|||||||
<div id="title-personal-space">
|
|||||||
<h2>Espace Personnel</h2>
|
|||||||
</div>
|
|||||||
)
|
|||||||
}
|
|||||||
|
|||||||
function TableData({ allTactics }: { allTactics: Tactic[] }) {
|
|||||||
const nbRow = Math.floor(allTactics.length / 3) + 1
|
|||||||
let listTactic = Array(nbRow)
|
|||||||
for (let i = 0; i < nbRow; i++) {
|
|||||||
listTactic[i] = Array(0)
|
|||||||
}
|
|||||||
let i = 0
|
|||||||
let j = 0
|
|||||||
allTactics.forEach((tactic) => {
|
|||||||
listTactic[i].push(tactic)
|
|||||||
j++
|
|||||||
if (j === 3) {
|
|||||||
i++
|
|||||||
j = 0
|
|||||||
}
|
|||||||
})
|
|||||||
|
|||||||
i = 0
|
|||||||
while (i < nbRow) {
|
|||||||
listTactic[i] = listTactic[i].map((tactic: Tactic) => (
|
|||||||
<td
|
|||||||
key={tactic.id}
|
|||||||
className="data"
|
|||||||
onClick={() => {
|
|||||||
location.pathname = "/tactic/" + tactic.id + "/edit"
|
|||||||
}}>
|
|||||||
{truncateString(tactic.name, 25)}
|
|||||||
</td>
|
|||||||
))
|
|||||||
i++
|
|||||||
}
|
|||||||
if (nbRow == 1) {
|
|||||||
if (listTactic[0].length < 3) {
|
|||||||
for (let i = 0; i <= 3 - listTactic[0].length; i++) {
|
|||||||
listTactic[0].push(<td key={"tdNone" + i}></td>)
|
|||||||
}
|
|||||||
}
|
|||||||
}
|
|||||||
|
|||||||
const data = listTactic.map((tactic, rowIndex) => (
|
|||||||
<tr key={rowIndex + "row"}>{tactic}</tr>
|
|||||||
))
|
|||||||
return data
|
|||||||
}
|
|||||||
|
|||||||
function BodyPersonalSpace({ allTactics }: { allTactics: Tactic[] }) {
|
|||||||
let data
|
|||||||
if (allTactics.length == 0) {
|
|||||||
data = <p>Aucune tactique créé !</p>
|
|||||||
} else {
|
|||||||
data = <TableData allTactics={allTactics} />
|
|||||||
}
|
|||||||
|
|||||||
return (
|
|||||||
<div id="body-personal-space">
|
|||||||
<table>
|
|||||||
<tbody key="tbody">{data}</tbody>
|
|||||||
</table>
|
|||||||
</div>
|
|||||||
)
|
|||||||
}
|
|||||||
|
|||||||
function Team({ teams }: { teams: Team[] }) {
|
|||||||
const listTeam = teams.map((team, rowIndex) => (
|
|||||||
<li key={"team" + rowIndex}>
|
|||||||
{team.name}
|
|||||||
<button onClick={() => (location.pathname = "/team/" + team.id)}>
|
|||||||
open
|
|||||||
</button>
|
|||||||
</li>
|
|||||||
))
|
|||||||
return (
|
|||||||
<div id="teams">
|
|||||||
<div className="titre-side-menu">
|
|||||||
<h2 className="title">Mes équipes</h2>
|
|||||||
<button
|
|||||||
className="new"
|
|||||||
onClick={() => (location.pathname = "/team/new")}>
|
|||||||
+
|
|||||||
</button>
|
|||||||
</div>
|
|||||||
<SetButtonTeam teams={teams} />
|
|||||||
</div>
|
|||||||
)
|
|||||||
}
|
|||||||
|
|||||||
function Tactic({ lastTactics }: { lastTactics: Tactic[] }) {
|
|||||||
return (
|
|||||||
<div id="tactic">
|
|||||||
<div className="titre-side-menu">
|
|||||||
<h2 className="title">Mes dernières stratégies</h2>
|
|||||||
<button
|
|||||||
className="new"
|
|||||||
id="create-tactic"
|
|||||||
onClick={() => (location.pathname = "/tactic/new")}>
|
|||||||
+
|
|||||||
</button>
|
|||||||
</div>
|
|||||||
<SetButtonTactic tactics={lastTactics} />
|
|||||||
</div>
|
|||||||
)
|
|||||||
}
|
|||||||
|
|||||||
function SetButtonTactic({ tactics }: { tactics: Tactic[] }) {
|
|||||||
const lastTactics = tactics.map((tactic) => (
|
|||||||
<ButtonLastTactic tactic={tactic} />
|
|||||||
))
|
|||||||
return <div className="set-button">{lastTactics}</div>
|
|||||||
}
|
|||||||
|
|||||||
function SetButtonTeam({ teams }: { teams: Team[] }) {
|
|||||||
const listTeam = teams.map((teams) => <ButtonTeam team={teams} />)
|
|||||||
return <div className="set-button">{listTeam}</div>
|
|||||||
}
|
|||||||
|
|||||||
function ButtonTeam({ team }: { team: Team }) {
|
|||||||
const name = truncateString(team.name, 20)
|
|||||||
return (
|
|||||||
<div>
|
|||||||
<div
|
|||||||
id={"button-team" + team.id}
|
|||||||
className="button-side-menu data"
|
|||||||
onClick={() => {
|
|||||||
location.pathname = "/team/" + team.id
|
|||||||
yanis.dahmane-bounoua marked this conversation as resolved
|
|||||||
}}>
|
|||||||
{name}
|
|||||||
</div>
|
|||||||
</div>
|
|||||||
)
|
|||||||
}
|
|||||||
|
|||||||
function ButtonLastTactic({ tactic }: { tactic: Tactic }) {
|
|||||||
const name = truncateString(tactic.name, 20)
|
|||||||
return (
|
|||||||
<div
|
|||||||
id={"button" + tactic.id}
|
|||||||
className="button-side-menu data"
|
|||||||
onClick={() => {
|
|||||||
location.pathname = "/tactic/" + tactic.id + "/edit"
|
|||||||
}}>
|
|||||||
{name}
|
|||||||
</div>
|
|||||||
)
|
|||||||
}
|
|||||||
|
|||||||
function truncateString(name: string, limit: number): string {
|
|||||||
if (name.length > limit) {
|
|||||||
name = name.substring(0, limit) + "..."
|
|||||||
}
|
|||||||
return name
|
|||||||
}
|
@ -0,0 +1,36 @@
|
||||
/**
|
||||
*
|
||||
* @param param0 username
|
||||
* @returns Header
|
||||
*/
|
||||
export function Header({ username }: { username: string }) {
|
||||
return (
|
||||
<div id="header">
|
||||
<div id="header-left"></div>
|
||||
<div id="header-center">
|
||||
<h1
|
||||
id="iqball"
|
||||
className="clickable"
|
||||
onClick={() => {
|
||||
location.pathname = "/"
|
||||
}}>
|
||||
<span id="IQ">IQ</span>
|
||||
<span id="Ball">Ball</span>
|
||||
</h1>
|
||||
</div>
|
||||
<div id="header-right">
|
||||
<div className="clickable" id="clickable-header-right">
|
||||
{/* <AccountSvg id="img-account" /> */}
|
||||
<img
|
||||
id="img-account"
|
||||
src="account.svg"
|
||||
onClick={() => {
|
||||
location.pathname = "/settings"
|
||||
}}
|
||||
/>
|
||||
<p id="username">{username}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
After Width: | Height: | Size: 747 B |
Loading…
Reference in new issue
empty css rule
not my production