From de5b4b72b6a85dd095db8610965cb543ec3548f8 Mon Sep 17 00:00:00 2001 From: MrFry Date: Thu, 19 Nov 2020 08:07:17 +0100 Subject: [PATCH 1/5] Description changes --- src/pages/contribute.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/contribute.js b/src/pages/contribute.js index 2b6b8e6..239fa11 100644 --- a/src/pages/contribute.js +++ b/src/pages/contribute.js @@ -74,7 +74,9 @@ export default function contribute() {
- Csak álnévvel commitolj git repókhoz! + Ha úgy érzed a fenti feladatok egyikét te is el tudod vállalni, IRC-n + vagy feedbackben üzenj, és elmondok minden infót róla. Itt találhatók a + git repositoryk. Csak álnévvel commitolj git repókhoz!
Git repo links
From 50e8fd271a60642661c8f92c59f9a10e713b59d9 Mon Sep 17 00:00:00 2001 From: mrfry Date: Sat, 28 Nov 2020 14:58:07 +0100 Subject: [PATCH 2/5] eslint root --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 74e14c5..8144b0d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,7 +3,6 @@ module.exports = { browser: true, es6: true, node: true, - jest: true, }, parser: 'babel-eslint', extends: ['eslint:recommended', 'plugin:react/recommended'], @@ -22,4 +21,5 @@ module.exports = { { exceptions: ['i', 'j', 't', 'Q', 'A', 'C', 'q', 'a', 'b'] }, ], }, + root: true } From c68a445117f5b70d50420d746e300e92cb7c66db Mon Sep 17 00:00:00 2001 From: mrfry Date: Sat, 28 Nov 2020 15:09:17 +0100 Subject: [PATCH 3/5] Todo table scroll, clickable columns now stored in server --- src/components/todoStuff/todoCard.js | 4 +--- src/components/todoStuff/todoTable.js | 12 +++++++++++- src/components/todoStuff/todoTable.module.css | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/todoStuff/todoCard.js b/src/components/todoStuff/todoCard.js index 432addf..2b5ea7b 100644 --- a/src/components/todoStuff/todoCard.js +++ b/src/components/todoStuff/todoCard.js @@ -2,10 +2,8 @@ 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 { categories, type, onClick, userId, clickableTypes } = props const { name, description, category, points, votes, id } = props.cardData const clickable = clickableTypes.includes(type) const voted = votes.includes(userId) diff --git a/src/components/todoStuff/todoTable.js b/src/components/todoStuff/todoTable.js index 8ef2659..9068edc 100644 --- a/src/components/todoStuff/todoTable.js +++ b/src/components/todoStuff/todoTable.js @@ -53,7 +53,7 @@ export default function TodoTable() { } return ( -
+
{Object.keys(columns).map((key) => { const category = columns[key] @@ -70,6 +70,16 @@ export default function TodoTable() { userId={userId} categories={categories} onClick={onCardClick} + clickableTypes={Object.keys(columns).reduce( + (acc, key) => { + const col = columns[key] + if (col.clickable) { + acc.push(key) + } + return acc + }, + [] + )} /> ) } else { diff --git a/src/components/todoStuff/todoTable.module.css b/src/components/todoStuff/todoTable.module.css index 91625be..72c421b 100644 --- a/src/components/todoStuff/todoTable.module.css +++ b/src/components/todoStuff/todoTable.module.css @@ -1,5 +1,7 @@ .table { display: flex; + min-width: 800px; + max-height: 600px; } .categoryName { @@ -14,3 +16,8 @@ .tableCol { flex: 1; } + +.tableContainer { + overflow-x: scroll; + overflow-y: scroll; +} From cc3def0e6f10efd9a8506e9a65849ca27c17207f Mon Sep 17 00:00:00 2001 From: mrfry Date: Sat, 28 Nov 2020 16:46:56 +0100 Subject: [PATCH 4/5] Contribute page imporvements, minor site imporvements --- src/components/todoStuff/todoCard.js | 3 +- src/components/todoStuff/todoTable.js | 101 ++++-------------- src/components/todoStuff/todoTable.module.css | 36 +++---- src/data/links.json | 8 ++ src/data/tabs.json | 2 +- src/pages/contribute.js | 45 +++----- src/pages/contribute.module.css | 12 +-- src/pages/index.js | 1 + src/pages/index.module.css | 8 +- 9 files changed, 78 insertions(+), 138 deletions(-) diff --git a/src/components/todoStuff/todoCard.js b/src/components/todoStuff/todoCard.js index 2b5ea7b..eaf0ea2 100644 --- a/src/components/todoStuff/todoCard.js +++ b/src/components/todoStuff/todoCard.js @@ -3,9 +3,8 @@ import React from 'react' import styles from './todoCard.module.css' export default function TodoCard(props) { - const { categories, type, onClick, userId, clickableTypes } = props + const { categories, onClick, userId, clickable } = props const { name, description, category, points, votes, id } = props.cardData - const clickable = clickableTypes.includes(type) const voted = votes.includes(userId) return ( diff --git a/src/components/todoStuff/todoTable.js b/src/components/todoStuff/todoTable.js index 9068edc..be909fa 100644 --- a/src/components/todoStuff/todoTable.js +++ b/src/components/todoStuff/todoTable.js @@ -1,90 +1,35 @@ -import React, { useState, useEffect } from 'react' +import React from 'react' -import LoadingIndicator from '../LoadingIndicator.js' -import TodoCard from './todoCard.js' +import TodoRow from './todoRow.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') - fetch(`${constants.apiUrl}todos`, { - credentials: 'include', - }) - .then((resp) => { - return resp.json() - }) - .then((data) => { - setTodos(data) - }) - }, []) - - const setTodos = (data) => { - setCards( - data.todos.cards.sort((a, b) => { - return b.votes.length - a.votes.length - }) - ) - 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) => { - setTodos(data) - }) - } - - if (!cards || !columns || !categories) { - return - } +export default function TodoBoard(props) { + const { tables, cards, userId, categories } = props return (
- {Object.keys(columns).map((key) => { - const category = columns[key] + {Object.keys(tables).map((key) => { + const table = tables[key] + + const tableCards = cards.filter((card) => { + return card.state === key + }) + return ( -
-
{category.name}
- {cards.map((card, i) => { - if (card.state === key) { - return ( - { - const col = columns[key] - if (col.clickable) { - acc.push(key) - } - return acc - }, - [] - )} - /> - ) - } else { - return null - } +
+
{table.name}
+ {tableCards.map((card, i) => { + return ( + + ) })}
) diff --git a/src/components/todoStuff/todoTable.module.css b/src/components/todoStuff/todoTable.module.css index 72c421b..eecc804 100644 --- a/src/components/todoStuff/todoTable.module.css +++ b/src/components/todoStuff/todoTable.module.css @@ -1,23 +1,17 @@ -.table { - display: flex; - min-width: 800px; - max-height: 600px; -} - -.categoryName { - text-align: center; - margin: 5px 0px; - font-size: 16px; - font-weight: bold; - color: white; - white-space: nowrap; -} - -.tableCol { - flex: 1; -} - .tableContainer { - overflow-x: scroll; - overflow-y: scroll; + margin: 5px 0px; +} + +.table { + justify-content: center; +} + +.container { + flex-direction: column; +} + +.title { + text-align: center; + font-size: 20px; + font-weight: bold; } diff --git a/src/data/links.json b/src/data/links.json index 2f5c064..d5e8e08 100644 --- a/src/data/links.json +++ b/src/data/links.json @@ -10,5 +10,13 @@ "data": { "href": "/data.json", "text": "Összes kérdés JSON" + }, + "irc": { + "href": "/irc", + "text": "IRC chat" + }, + "dataeditor": { + "href": "/dataeditor", + "text": "Dataeditor" } } diff --git a/src/data/tabs.json b/src/data/tabs.json index 468bd44..54e1af5 100644 --- a/src/data/tabs.json +++ b/src/data/tabs.json @@ -25,7 +25,7 @@ }, "contribute": { "href": "/contribute", - "text": "Contribute / Todos" + "text": "Todos, contribute" }, "ranklist": { "href": "/ranklist", diff --git a/src/pages/contribute.js b/src/pages/contribute.js index 2b6b8e6..8bea662 100644 --- a/src/pages/contribute.js +++ b/src/pages/contribute.js @@ -1,8 +1,8 @@ import React, { useState } from 'react' -import Button from '../components/Button.js' import Sleep from '../components/sleep' -import TodoTable from '../components/todoStuff/todoTable' +import Todos from '../components/todoStuff/todos' +import Button from '../components/Button.js' import constants from '../constants.json' import styles from './contribute.module.css' @@ -68,39 +68,26 @@ export default function contribute() { annál nehezebb a feladat. Tartsd egeret kártyán részletesebb leírásért (ha van hozzá)
- +
Itt írhatsz todo-ra ötleteket
{renderNewTaskArea()}
-
- Csak álnévvel commitolj git repókhoz! -
+
Git repos
+
+
-
Git repo links
- {Object.keys(repos.repos).map((key) => { - let repo = repos.repos[key] - return ( - - ) - })} +
    + {Object.keys(repos.repos).map((key) => { + let repo = repos.repos[key] + return ( +
  • + {repo.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 -
-
) } diff --git a/src/pages/contribute.module.css b/src/pages/contribute.module.css index 1c90498..081839f 100644 --- a/src/pages/contribute.module.css +++ b/src/pages/contribute.module.css @@ -1,9 +1,3 @@ -.repos { - display: flex; - flex-direction: column; - align-items: center; -} - .description { font-size: 15px; color: white; @@ -39,3 +33,9 @@ .inputArea { display: flex; } + +.title { + color: #9999ff; + font-size: 30px; + text-align: center; +} diff --git a/src/pages/index.js b/src/pages/index.js index 6228cf3..128da42 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -163,6 +163,7 @@ export default function Index({ router }) { {renderMotd()} {userSpecificMotd && renderUserSpecificMotd()}
+
{renderNews()}
diff --git a/src/pages/index.module.css b/src/pages/index.module.css index c8902cb..fdfd0e0 100644 --- a/src/pages/index.module.css +++ b/src/pages/index.module.css @@ -7,10 +7,11 @@ color: white; background-color: #303030; margin: 2px; - padding: 15px 32px; + padding: 10px 5px; text-align: center; font-size: 16px; cursor: pointer; + word-wrap: break-word; display: flex; flex-direction: column; @@ -69,3 +70,8 @@ margin: 0px 5px; font-size: 24px; } + +.repos { + display: flex; + flex-direction: column; +} From db5aad0f8c5def9ed2e4ba8e36263f3e48dd49ab Mon Sep 17 00:00:00 2001 From: mrfry Date: Sat, 28 Nov 2020 16:49:52 +0100 Subject: [PATCH 5/5] Added missing files --- src/components/todoStuff/todoBoard.js | 49 ++++++++ src/components/todoStuff/todoBoard.module.css | 23 ++++ src/components/todoStuff/todoRow.js | 34 ++++++ src/components/todoStuff/todoRow.module.css | 40 +++++++ src/components/todoStuff/todos.js | 107 ++++++++++++++++++ 5 files changed, 253 insertions(+) create mode 100644 src/components/todoStuff/todoBoard.js create mode 100644 src/components/todoStuff/todoBoard.module.css create mode 100644 src/components/todoStuff/todoRow.js create mode 100644 src/components/todoStuff/todoRow.module.css create mode 100644 src/components/todoStuff/todos.js diff --git a/src/components/todoStuff/todoBoard.js b/src/components/todoStuff/todoBoard.js new file mode 100644 index 0000000..36d0abd --- /dev/null +++ b/src/components/todoStuff/todoBoard.js @@ -0,0 +1,49 @@ +import React from 'react' + +import TodoCard from './todoCard.js' + +import styles from './todoBoard.module.css' + +export default function TodoBoard(props) { + const { columns, cards, userId, categories, onCardClick } = props + + const clickableTypes = Object.keys(columns).reduce((acc, key) => { + const col = columns[key] + if (col.clickable) { + acc.push(key) + } + return acc + }, []) + + return ( +
+
+ {Object.keys(columns).map((key) => { + const category = columns[key] + return ( +
+
{category.name}
+ {cards.map((card, i) => { + if (card.state === key) { + // TODO: determine if clickable here + return ( + + ) + } else { + return null + } + })} +
+ ) + })} +
+
+ ) +} diff --git a/src/components/todoStuff/todoBoard.module.css b/src/components/todoStuff/todoBoard.module.css new file mode 100644 index 0000000..7e603fa --- /dev/null +++ b/src/components/todoStuff/todoBoard.module.css @@ -0,0 +1,23 @@ +.tableContainer { + overflow-y: hidden; + overflow-x: auto; + margin: 5px 0px; +} + +.table { + display: flex; + min-width: 800px; +} + +.categoryName { + text-align: center; + margin: 5px 0px; + font-size: 16px; + font-weight: bold; + color: white; + white-space: nowrap; +} + +.tableCol { + flex: 1; +} diff --git a/src/components/todoStuff/todoRow.js b/src/components/todoStuff/todoRow.js new file mode 100644 index 0000000..6714428 --- /dev/null +++ b/src/components/todoStuff/todoRow.js @@ -0,0 +1,34 @@ +import React from 'react' + +import styles from './todoRow.module.css' + +export default function TodoRow(props) { + const { categories, userId } = props + const { name, description, category, votes, id } = props.rowData + const voted = votes.includes(userId) + + return ( +
+
{`#${id}`}
+
{name}
+
+
+ {categories[category].name} +
+
+
{`Votes: ${votes.length}`}
+
+ ) +} diff --git a/src/components/todoStuff/todoRow.module.css b/src/components/todoStuff/todoRow.module.css new file mode 100644 index 0000000..18af760 --- /dev/null +++ b/src/components/todoStuff/todoRow.module.css @@ -0,0 +1,40 @@ +.row { + display: flex; + border: 2px solid #99f; + border-radius: 2px; + padding: 5px; + margin: 6px 3px; +} + +.row > div { + margin: 0px 5px; +} + +.id { + flex: 0 20px; + margin: 0px 3px; + color: #999; +} + +.description { + flex: 1; + word-break: normal; + font-size: 14px; + color: white; +} + +.votes { +} + +.voted { + border: 2px solid #cf9; +} + +.catName { + display: flex; +} + +.category { + word-break: break-all; + font-size: 10px; +} diff --git a/src/components/todoStuff/todos.js b/src/components/todoStuff/todos.js new file mode 100644 index 0000000..27956bf --- /dev/null +++ b/src/components/todoStuff/todos.js @@ -0,0 +1,107 @@ +import React, { useState, useEffect } from 'react' + +import LoadingIndicator from '../LoadingIndicator.js' +import TodoBoard from './todoBoard.js' +import TodoTable from './todoTable.js' + +import constants from '../../constants.json' + +const byVotes = (a, b) => { + return b.votes.length - a.votes.length +} + +export default function Todos() { + const [loaded, setLoaded] = useState(false) + const [columns, setColumns] = useState(null) + const [boardCards, setBoardCards] = useState(null) + const [tables, setTables] = useState(null) + const [tableCards, setTableCards] = useState(null) + const [categories, setCategories] = useState(null) + const [userId, setUserId] = useState(null) + + useEffect(() => { + console.info('Fetching todos') + fetch(`${constants.apiUrl}todos`, { + credentials: 'include', + }) + .then((resp) => { + return resp.json() + }) + .then((data) => { + setTodos(data) + }) + }, []) + + const setTodos = (data) => { + setCategories(data.todos.categories) + setUserId(data.userId) + + let bCards = [] + let tCards = [] + data.todos.cards.forEach((card) => { + if (data.todos.columns[card.state].type === 'table') { + tCards.push(card) + } else { + bCards.push(card) + } + }) + + setTableCards(tCards.sort(byVotes)) + setBoardCards(bCards.sort(byVotes)) + + let cols = {} + let tables = {} + Object.keys(data.todos.columns).forEach((key) => { + const col = data.todos.columns[key] + if (col.type !== 'table') { + cols = { + ...cols, + [key]: col, + } + } else { + tables = { + ...tables, + [key]: col, + } + } + }) + setColumns(cols) + setTables(tables) + + setLoaded(true) + } + + const onCardClick = (id) => { + fetch(`${constants.apiUrl}todos?id=${id}`, { + credentials: 'include', + }) + .then((resp) => { + return resp.json() + }) + .then((data) => { + setTodos(data) + }) + } + + if (!loaded) { + return + } + + return ( +
+ + +
+ ) +}