mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Added todo table
This commit is contained in:
parent
1a982b69c9
commit
cbd6bf2baa
15 changed files with 608 additions and 157 deletions
|
@ -1,50 +0,0 @@
|
|||
import styles from './Helps.module.css'
|
||||
|
||||
import helps from '../data/helps.json'
|
||||
const header = helps.header
|
||||
const helpRows = helps.rows
|
||||
|
||||
export default function Helps () {
|
||||
const renderTable = () => {
|
||||
return (
|
||||
<table className={styles.helpTable}>
|
||||
<thead>
|
||||
<tr className={styles.helpHeader}>
|
||||
{header.map((h, i) => {
|
||||
return (
|
||||
<td key={i}>
|
||||
{h}
|
||||
</td>
|
||||
)
|
||||
})}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{Object.keys(helpRows).map((key, i) => {
|
||||
const item = helpRows[key]
|
||||
return (
|
||||
<tr className={styles.helpRow} key={i}>
|
||||
<td>
|
||||
{item.name}
|
||||
</td>
|
||||
<td>
|
||||
{item.description}
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div className={styles.text}>
|
||||
<div className={styles.title}>
|
||||
Amiben tudsz segíteni:
|
||||
</div>
|
||||
<div>
|
||||
{renderTable()}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
.text {
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.helpTable {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.helpTable td {
|
||||
padding: 5px 2px;
|
||||
}
|
||||
|
||||
.helpHeader {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.helpRow td {
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
}
|
48
src/components/todoStuff/todoCard.js
Normal file
48
src/components/todoStuff/todoCard.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
import React from 'react'
|
||||
|
||||
import styles from './todoCard.module.css'
|
||||
|
||||
const clickableTypes = ['todo', 'blocked', 'inprogress', 'testing']
|
||||
|
||||
export default function TodoCard(props) {
|
||||
const { categories, type, onClick, userId } = props
|
||||
const { name, description, category, points, votes, id } = props.cardData
|
||||
const clickable = clickableTypes.includes(type)
|
||||
const voted = votes.includes(userId)
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`${styles.card} ${clickable && styles.clickable} ${voted &&
|
||||
styles.voted}`}
|
||||
title={description}
|
||||
onClick={() => {
|
||||
if (clickable) {
|
||||
onClick(id)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className={styles.description}>
|
||||
<span className={styles.id}>{`#${id}`}</span>
|
||||
{name}
|
||||
</div>
|
||||
<div className={styles.category}>
|
||||
<span
|
||||
style={{
|
||||
backgroundColor: categories[category].color,
|
||||
color: 'white',
|
||||
borderRadius: '2px',
|
||||
padding: '0px 2px',
|
||||
}}
|
||||
>
|
||||
{category}
|
||||
</span>
|
||||
</div>
|
||||
<div className={styles.numbers}>
|
||||
<div>
|
||||
<div>{`Votes: ${votes.length}`}</div>
|
||||
</div>
|
||||
<div>{points}</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
48
src/components/todoStuff/todoCard.module.css
Normal file
48
src/components/todoStuff/todoCard.module.css
Normal file
|
@ -0,0 +1,48 @@
|
|||
.card {
|
||||
border: 2px solid #99f;
|
||||
border-radius: 2px;
|
||||
padding: 5px;
|
||||
margin: 6px 3px;
|
||||
}
|
||||
|
||||
.voted {
|
||||
border: 2px solid #cf9;
|
||||
}
|
||||
|
||||
.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.clickable:hover {
|
||||
background-color: #333;
|
||||
border: 2px solid #f99;
|
||||
}
|
||||
|
||||
.card > div {
|
||||
margin: 5px 0px;
|
||||
}
|
||||
|
||||
.description {
|
||||
word-break: normal;
|
||||
font-size: 14px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.category {
|
||||
word-break: break-all;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.numbers {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.numbers > div {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.id {
|
||||
margin: 0px 3px;
|
||||
color: #999;
|
||||
}
|
82
src/components/todoStuff/todoTable.js
Normal file
82
src/components/todoStuff/todoTable.js
Normal file
|
@ -0,0 +1,82 @@
|
|||
import React, { useState, useEffect } from 'react'
|
||||
|
||||
import LoadingIndicator from '../LoadingIndicator.js'
|
||||
import TodoCard from './todoCard.js'
|
||||
|
||||
import constants from '../../constants.json'
|
||||
import styles from './todoTable.module.css'
|
||||
|
||||
export default function TodoTable() {
|
||||
const [cards, setCards] = useState(null)
|
||||
const [columns, setColumns] = useState(null)
|
||||
const [categories, setCategories] = useState(null)
|
||||
const [userId, setUserId] = useState(null)
|
||||
|
||||
useEffect(() => {
|
||||
console.info('Fetching todos')
|
||||
getTodos()
|
||||
}, [])
|
||||
|
||||
const getTodos = () => {
|
||||
fetch(`${constants.apiUrl}todos`, {
|
||||
credentials: 'include',
|
||||
})
|
||||
.then((resp) => {
|
||||
return resp.json()
|
||||
})
|
||||
.then((data) => {
|
||||
setCards(data.todos.cards)
|
||||
setColumns(data.todos.columns)
|
||||
setCategories(data.todos.categories)
|
||||
setUserId(data.userId)
|
||||
})
|
||||
}
|
||||
|
||||
const onCardClick = (id) => {
|
||||
fetch(`${constants.apiUrl}todos?id=${id}`, {
|
||||
credentials: 'include',
|
||||
})
|
||||
.then((resp) => {
|
||||
return resp.json()
|
||||
})
|
||||
.then((data) => {
|
||||
console.log(data)
|
||||
getTodos()
|
||||
})
|
||||
}
|
||||
|
||||
if (!cards || !columns || !categories) {
|
||||
return <LoadingIndicator />
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={styles.table}>
|
||||
{Object.keys(columns).map((key) => {
|
||||
const category = columns[key]
|
||||
return (
|
||||
<div className={styles.tableCol} key={key}>
|
||||
<div className={styles.categoryName}>{category.name}</div>
|
||||
{cards.map((card, i) => {
|
||||
if (card.state === key) {
|
||||
return (
|
||||
<TodoCard
|
||||
key={i}
|
||||
type={key}
|
||||
cardData={card}
|
||||
userId={userId}
|
||||
categories={categories}
|
||||
onClick={onCardClick}
|
||||
/>
|
||||
)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
16
src/components/todoStuff/todoTable.module.css
Normal file
16
src/components/todoStuff/todoTable.module.css
Normal file
|
@ -0,0 +1,16 @@
|
|||
.table {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.categoryName {
|
||||
text-align: center;
|
||||
margin: 5px 0px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tableCol {
|
||||
flex: 1;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"siteUrl": "https://qmining.frylabs.net/",
|
||||
"apiUrl": "https://api.frylabs.net/",
|
||||
"apiUrl": "http://localhost:8080/",
|
||||
"mobileWindowWidth": 700,
|
||||
"maxQuestionsToRender": 250
|
||||
}
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
"name": "Visszajelzésben",
|
||||
"description": "Meséld el mi nem tetszik, és mit csinálnál máshogy! Apró részletek is jöhetnek."
|
||||
},
|
||||
"translator": {
|
||||
"name": "Fogalmazásban",
|
||||
"description": "Fogalmazd meg felhasználóbarátan azokat a szövegeket/stringeket amikkel a weboldalon és a script használata közben találkozol!"
|
||||
},
|
||||
"bugreporter": {
|
||||
"name": "Bug reportolásban",
|
||||
"description": "Jelents akármit ami nem úgy működik ahogy kellene! Akár egy rövid leírás is segíthet, de ha tutira akarsz menni akkor a 'Feedback' fülön tölts ki mindent. Ha kérdés közben van hiba ments le azt a kérdés oldalt (CTRL + S), és a teszt végén az eredmények oldalt, és küld el itt. Így tudom könnyen reprodukálni a problémát."
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
{
|
||||
"description": "Projekt repók. Itt megtalálod az összes projektet ami működteti az egész rendszert, és hozzá egy rövid leírást, az issues linket ahol látod az eddigi problémákat/hozzá tudsz adni újjakat, illetve linket a fejlesztési doksikhoz. Amik röviden leírások hogy hogyan kell setupolni a projektet, elindítani, debugolni, tesztelni",
|
||||
"header": [
|
||||
"Leírás",
|
||||
"GitLab",
|
||||
"Devel docs"
|
||||
],
|
||||
"repos":{
|
||||
"repos": {
|
||||
"userScriptRepo": {
|
||||
"description": "User script kliens szerverhez",
|
||||
"href": "https://gitlab.com/MrFry/moodle-test-userscript"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
},
|
||||
"contribute": {
|
||||
"href": "/contribute",
|
||||
"text": "Contribute"
|
||||
"text": "Contribute / Todos"
|
||||
},
|
||||
"ranklist": {
|
||||
"href": "/ranklist",
|
||||
|
|
|
@ -1,74 +1,51 @@
|
|||
import React from 'react'
|
||||
|
||||
import Button from '../components/Button.js'
|
||||
import Helps from '../components/Helps.js'
|
||||
import Sleep from '../components/sleep'
|
||||
import TodoTable from '../components/todoStuff/todoTable'
|
||||
|
||||
import styles from './contribute.module.css'
|
||||
import repos from '../data/repos.json'
|
||||
|
||||
export default function contribute (props) {
|
||||
export default function contribute() {
|
||||
return (
|
||||
<div>
|
||||
<TodoTable />
|
||||
<div className={styles.description}>
|
||||
Egy kártyára kattintva szavazhatsz. Minél több szavazat érkezik egy
|
||||
kártyára, annál magasabb lesz a pioritása
|
||||
</div>
|
||||
<Sleep />
|
||||
<Helps />
|
||||
<hr />
|
||||
<div className={styles.description}>
|
||||
{repos.description}
|
||||
Akkárhogy próbálsz segíteni a projektben, akkor azt saját érdekedben
|
||||
csak álnévvel tedd!!!
|
||||
</div>
|
||||
<div className={styles.description}>
|
||||
Ha commitolsz, vagy akkárhogy próbálsz segíteni a projektben, akkor azt saját érdekedben
|
||||
csak névtelenül, vagy álnévvel tedd!!!
|
||||
<div className={styles.repos}>
|
||||
<div>Git repo links</div>
|
||||
{Object.keys(repos.repos).map((key) => {
|
||||
let repo = repos.repos[key]
|
||||
return (
|
||||
<div key={key}>
|
||||
<a href={repo.href}>{repo.description}</a>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<table className={styles.repoTable}>
|
||||
<thead>
|
||||
<tr>
|
||||
{repos.header.map((x, i) => {
|
||||
return (
|
||||
<td key={i}>
|
||||
{x}
|
||||
</td>
|
||||
)
|
||||
})}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{Object.keys(repos.repos).map((key) => {
|
||||
let repo = repos.repos[key]
|
||||
return (
|
||||
<tr
|
||||
key={key}
|
||||
>
|
||||
<td>
|
||||
{repo.description}
|
||||
</td>
|
||||
<td>
|
||||
<a href={repo.href}>
|
||||
GitLab repo
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href={repo.href + '/tree/master/devel'}>
|
||||
Devel docs
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<div className={styles.description}>
|
||||
IRC chat: egy IRC chatszoba van létrehozva egy random szerveren, ahol tudsz azonnal üzenni,
|
||||
és ha épp fent vagyok akkor azonnal válaszolok
|
||||
IRC chat: egy IRC chatszoba van létrehozva egy random szerveren, ahol
|
||||
tudsz azonnal üzenni, és ha épp fent vagyok akkor azonnal válaszolok
|
||||
</div>
|
||||
<Button text='IRC chat' href='/irc' />
|
||||
<Button text="IRC chat" href="/irc" />
|
||||
<hr />
|
||||
<div className={styles.description}>
|
||||
Kérdés szerkesztő: Ezen az oldalon lehet szerkeszteni az összes kérdést, duplikációkat
|
||||
eltávolítani vagy helytelen válaszokat kijavítani kézzel. Ha van hozzá jelszavad, akkor ezt
|
||||
azonnal el tudod menteni, és éles adatbázis frissül ezzel, ha nincs és úgy érzed szeretnél
|
||||
akkor kattints a fenti 'IRC chat' gombra!
|
||||
Kérdés szerkesztő: Ezen az oldalon lehet szerkeszteni az összes kérdést,
|
||||
duplikációkat eltávolítani vagy helytelen válaszokat kijavítani kézzel.
|
||||
Ha van hozzá jelszavad, akkor ezt azonnal el tudod menteni, ha nincs és
|
||||
úgy érzed szeretnél akkor kattints a fenti IRC chat gombra!
|
||||
</div>
|
||||
<Button text='Data Editor' href='/dataeditor' />
|
||||
<Button text="Data Editor" href="/dataeditor" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,27 +1,16 @@
|
|||
.repoTable {
|
||||
width: 100%;
|
||||
.repos {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.description {
|
||||
font-size: 17px;
|
||||
font-size: 15px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.repoTable thead td {
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
font-size: 25px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.repoTable tbody td {
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: white;
|
||||
padding: 10px;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue