diff --git a/constants.js b/constants.js new file mode 100644 index 0000000..721e954 --- /dev/null +++ b/constants.js @@ -0,0 +1,16 @@ +// eslint-disable-next-line no-undef +const useLocalhost = process && process.env.NODE_ENV === 'development' + +const constants = { + siteUrl: !useLocalhost ? 'http://frylabs.net/' : 'http://localhost:8080/', + apiUrl: !useLocalhost + ? 'http://frylabs.net/api/' + : 'http://localhost:8080/api/', + chatUrl: !useLocalhost ? 'http://frylabs.net/' : 'http://localhost:8080/', + mobileWindowWidth: 700, + maxQuestionsToRender: 250, + imageExts: ['gif', 'png', 'jpeg', 'jpg'], + videoExts: ['mp4', 'mkv', 'webm'], +} + +export default constants diff --git a/src/components/Question.jsx b/src/components/Question.jsx index 3a67325..c1337f9 100644 --- a/src/components/Question.jsx +++ b/src/components/Question.jsx @@ -6,7 +6,15 @@ function highlightText(text, toHighlight) { } try { const re = new RegExp(toHighlight, 'gi') - return text.replace(re, `${toHighlight}`) + const splitText = text.split(toHighlight) + console.log(splitText) + return ( + <> + {splitText[0]} + {toHighlight} + {splitText[1]} + + ) } catch (e) { return text } diff --git a/src/components/QuestionSearchResult.jsx b/src/components/QuestionSearchResult.jsx index 2af0324..8a94554 100644 --- a/src/components/QuestionSearchResult.jsx +++ b/src/components/QuestionSearchResult.jsx @@ -2,7 +2,7 @@ import React from 'react' import Questions from './Questions' -import constants from '../constants.json' +import constants from '../constants' const countReducer = (acc, subj) => { return acc + subj.Questions.length diff --git a/src/components/b.jsx b/src/components/b.jsx index b5afd88..7a7c496 100644 --- a/src/components/b.jsx +++ b/src/components/b.jsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react' -import constants from '../constants.json' +import constants from '../constants' const soundCount = 7 function GetRandom(min, max) { diff --git a/src/components/composer.jsx b/src/components/composer.jsx index 9ebb665..1f9054f 100644 --- a/src/components/composer.jsx +++ b/src/components/composer.jsx @@ -3,7 +3,7 @@ import React, { useState } from 'react' import Modal from './modal' import styles from './composer.module.css' -import constants from '../constants.json' +import constants from '../constants' export default function Composer({ onSubmit, allowFile, fileOnly }) { const [editorShowing, setEditorShowing] = useState(false) diff --git a/src/components/dbSelector.jsx b/src/components/dbSelector.jsx index 202ec1f..5bb3153 100644 --- a/src/components/dbSelector.jsx +++ b/src/components/dbSelector.jsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' import Modal from './modal' -import constants from '../constants.json' +import constants from '../constants' import styles from './dbSelector.module.css' diff --git a/src/components/feedbackArea.jsx b/src/components/feedbackArea.jsx index e2b40b7..95b6b48 100644 --- a/src/components/feedbackArea.jsx +++ b/src/components/feedbackArea.jsx @@ -1,7 +1,7 @@ import React, { useState } from 'react' import styles from './feedbackArea.module.css' -import constants from '../constants.json' +import constants from '../constants' function FileUploader({ onChange }) { return ( diff --git a/src/components/forum.jsx b/src/components/forum.jsx index d731485..6aed857 100644 --- a/src/components/forum.jsx +++ b/src/components/forum.jsx @@ -8,7 +8,7 @@ import Header from '../components/header' import Modal from '../components/modal' import styles from './forum.module.css' -import constants from '../constants.json' +import constants from '../constants' const forumPostPerPage = 5 diff --git a/src/components/layout.jsx b/src/components/layout.jsx index e2a26b0..f9a0895 100644 --- a/src/components/layout.jsx +++ b/src/components/layout.jsx @@ -7,7 +7,7 @@ const Snowfall = dynamic(() => import('react-snowfall'), { ssr: false }) import LogoutIcon from './logoutIcon' import Modal from './modal' -import constants from '../constants.json' +import constants from '../constants' import BB from './b' import styles from './layout.module.css' @@ -67,36 +67,35 @@ function TopBar({ unreads, userId, }) { - return <> - - + return ( + <> + + + FryLabs + +
+ {Object.keys(topBarLinks).map((key) => { + const item = topBarLinks[key] - FryLabs - - -
- {Object.keys(topBarLinks).map((key) => { - const item = topBarLinks[key] - - return ( - ( - - {item.text} - - ) - ); - })} -
-
- - ; + return ( + + {item.text} + + ) + })} +
+
+ + + ) } function SideBar({ sidebarOpen, closeSideBar, href, setDonateShowing }) { @@ -110,17 +109,16 @@ function SideBar({ sidebarOpen, closeSideBar, href, setDonateShowing }) { } return ( - ( - + id={item.id || undefined} + > {item.text} - - ) - ); + + ) })} { @@ -132,7 +130,7 @@ function SideBar({ sidebarOpen, closeSideBar, href, setDonateShowing }) {
- ) : null; + ) : null } function Donate() { @@ -187,11 +185,10 @@ function UserStatus({ userId, unreads, onClick }) { href="/chat" onClick={onClick} title={`Chat${unreadCount ? ' (' + unreadCount + ' új üzenet)' : ''}`} - className={styles.unreadNotification}> - + className={styles.unreadNotification} + > 💬 {unreadCount ?
{unreadCount}
: null} -
- ); + ) } function MenuIcon({ setSidebarOpen, sidebarOpen }) { diff --git a/src/components/newsEntry.jsx b/src/components/newsEntry.jsx index 85f2a4b..e3e4503 100644 --- a/src/components/newsEntry.jsx +++ b/src/components/newsEntry.jsx @@ -4,7 +4,7 @@ import ReactButton from './reactButton' import Comments from './comments' import Link from 'next/link' -import constants from '../constants.json' +import constants from '../constants' import styles from './newsEntry.module.css' @@ -95,9 +95,9 @@ export default function NewsEntry({ + className={'userId'} + > User #{user} -
@ @@ -145,5 +145,5 @@ export default function NewsEntry({ />
- ); + ) } diff --git a/src/components/sleep.jsx b/src/components/sleep.jsx index effa908..2134160 100644 --- a/src/components/sleep.jsx +++ b/src/components/sleep.jsx @@ -1,5 +1,5 @@ import React from 'react' -import constants from '../constants.json' +import constants from '../constants' export default function Sleep() { const hours = new Date().getHours() diff --git a/src/components/todoStuff/todo.module.css b/src/components/todoStuff/todo.module.css deleted file mode 100644 index 3d30862..0000000 --- a/src/components/todoStuff/todo.module.css +++ /dev/null @@ -1,7 +0,0 @@ -.groupDescription { - font-size: 16px; - padding: 4px; -} - -.todoButtons { -} diff --git a/src/components/todoStuff/todoBoard.jsx b/src/components/todoStuff/todoBoard.jsx deleted file mode 100644 index f6cc705..0000000 --- a/src/components/todoStuff/todoBoard.jsx +++ /dev/null @@ -1,59 +0,0 @@ -import React from 'react' - -import TodoCard from './todoCard' - -import styles from './todoBoard.module.css' - -export default function TodoBoard(props) { - const { columns, cards, userId, categories, onCardClick, selectedGroup } = - 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] - const cardsToShow = cards.filter((card) => { - const shouldHide = - card.state !== key || - (selectedGroup !== null && - selectedGroup !== 'uncat' && - card.group !== selectedGroup) || - (selectedGroup === 'uncat' && card.group !== undefined) - - return !shouldHide - }) - return ( -
-
{category.name}
- - {cardsToShow.length === 0 && ( -
Üres
- )} - {cardsToShow.map((card, i) => { - return ( - - ) - })} -
- ) - })} -
-
- ) -} diff --git a/src/components/todoStuff/todoBoard.module.css b/src/components/todoStuff/todoBoard.module.css deleted file mode 100644 index 4097db9..0000000 --- a/src/components/todoStuff/todoBoard.module.css +++ /dev/null @@ -1,28 +0,0 @@ -.tableContainer { - overflow-y: hidden; - overflow-x: auto; - margin: 5px 0px; -} - -.table { - display: flex; -} - -.categoryName { - text-align: center; - margin: 5px 0px; - font-size: 16px; - font-weight: bold; - color: white; - white-space: nowrap; -} - -.tableCol { - flex: 1; -} - -.empty { - display: flex; - justify-content: center; - padding: 10px 0px; -} diff --git a/src/components/todoStuff/todoCard.jsx b/src/components/todoStuff/todoCard.jsx deleted file mode 100644 index f783307..0000000 --- a/src/components/todoStuff/todoCard.jsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react' - -import styles from './todoCard.module.css' - -export default function TodoCard(props) { - const { categories, onClick, userId } = props - const { name, category, points, votes, id, group } = props.cardData - const voted = votes.includes(userId) - - return ( -
{ - onClick(props.cardData) - }} - > -
- {`#${id}`} - {name} -
-
- - {categories[category].name} - -
-
-
{`Szavazatok: ${votes.length}`}
-
{`Nehézség: ${points}`}
-
-
- ) -} diff --git a/src/components/todoStuff/todoCard.module.css b/src/components/todoStuff/todoCard.module.css deleted file mode 100644 index 9b9b63c..0000000 --- a/src/components/todoStuff/todoCard.module.css +++ /dev/null @@ -1,47 +0,0 @@ -.card { - border-radius: 5px; - padding: 7px; - margin: 8px 4px; - cursor: pointer; - background-color: #171616; -} - -.voted { - color: var(--text-color); - font-weight: 600; -} - -.card:hover { - background-color: #333; - border: 2px solid #f99; -} - -.card > div { - margin: 6px 4px; -} - -.description { - word-break: normal; - font-size: 14px; - color: white; -} - -.category { - font-size: 12px; - white-space: nowrap; -} - -.numbers { - display: flex; - justify-content: space-between; - flex-wrap: wrap; -} - -.numbers > div { - font-size: 12px; -} - -.id { - margin: 1px 6px 1px 1px; - color: #999; -} diff --git a/src/components/todoStuff/todoRow.jsx b/src/components/todoStuff/todoRow.jsx deleted file mode 100644 index 6c8eee2..0000000 --- a/src/components/todoStuff/todoRow.jsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react' - -import styles from './todoRow.module.css' - -export default function TodoRow(props) { - const { categories, userId, onClick } = props - const { name, category, votes, id, group } = props.rowData - const voted = votes.includes(userId) - const borderColor = - categories[category].borderColor || categories[category].color - - return ( -
{ - onClick(props.rowData) - }} - className={styles.row} - style={{ - border: `2px dashed ${borderColor || 'white'}`, - borderRadius: '3px', - }} - > -
{`#${id}`}
-
{name}
-
-
- {categories[category].name} -
-
-
{`Szavazatok: ${votes.length}`}
-
- ) -} diff --git a/src/components/todoStuff/todoRow.module.css b/src/components/todoStuff/todoRow.module.css deleted file mode 100644 index 472b6c8..0000000 --- a/src/components/todoStuff/todoRow.module.css +++ /dev/null @@ -1,49 +0,0 @@ -.row { - border-radius: 5px; - padding: 7px; - margin: 8px 4px; - cursor: pointer; - background-color: #171616; -} - -.row:hover { - background-color: #333; - border: 2px solid #f99; -} - -.row > div { - margin: 6px 4px; -} - -.id { - flex: 0 20px; - margin: 1px 6px 1px 1px; - color: #999; -} - -.description { - flex: 1; - word-break: normal; - font-size: 14px; - color: white; -} - -.votes { - display: flex; - justify-content: space-between; - font-size: 12px; -} - -.voted { - color: var(--text-color); - font-weight: 600; -} - -.catName { - display: flex; -} - -.category { - font-size: 10px; - white-space: nowrap; -} diff --git a/src/components/todoStuff/todoSidebar.jsx b/src/components/todoStuff/todoSidebar.jsx deleted file mode 100644 index 3afbeca..0000000 --- a/src/components/todoStuff/todoSidebar.jsx +++ /dev/null @@ -1,111 +0,0 @@ -import React from 'react' - -import styles from './todoSidebar.module.css' - -export default function Todos({ - card, - userId, - categories, - columns, - voteOn, - namedGroups, -}) { - const { - name, - description, - category, - points, - votes, - id, - group, - gitlink, - } = card - const voteable = columns[card.state].clickable - - // TODO: hide vote button if not voteable - return ( -
-
- #{id} -
- {name} -
- - {categories[category].name} - -
-
- {group && ( -
-
Csoport:
-
- {namedGroups[group] ? namedGroups[group].name : group} -
-
- )} -
-
Nehézség:
-
{points}
-
-
-
Szavazatok:
-
{votes.length}
-
- {gitlink && ( -
-
- - Git link - -
-
- )} -
- {description && ( - <> -
- Leírás -
-
-
- - )} -
- {voteable && ( -
-
-
{ - voteOn(card) - }} - > - {votes.includes(userId) ? 'Szavazat visszavonása' : 'Szavazás'} -
-
-
- )} -
- ) -} diff --git a/src/components/todoStuff/todoSidebar.module.css b/src/components/todoStuff/todoSidebar.module.css deleted file mode 100644 index 9566a59..0000000 --- a/src/components/todoStuff/todoSidebar.module.css +++ /dev/null @@ -1,66 +0,0 @@ -.container { - display: flex; - flex-flow: column; - margin: 5px; -} - -.container > hr { - width: 100%; -} - -.title { - color: var(--text-color); - font-size: 18px; -} - -.title { - color: var(--text-color); - font-size: 20px; - margin: 5px 0px; -} - -.name { -} - -.category { - word-break: break-all; - font-size: 10px; -} - -.id { - font-size: 20px; - margin: 0px 3px; - color: #999; -} - -.description { - overflow-x: auto; - overflow-y: auto; - max-height: calc(38vh); - margin: 5px; -} - -.row { - display: flex; - justify-content: space-between; - margin: 2px 10px; - flex-wrap: wrap; -} - -.button { - border: 2px solid var(--text-color); - border-radius: 3px; - text-align: center; - cursor: pointer; -} - -.button:hover { - background-color: #333; -} - -.votedtext { - color: #cf9; -} -.voted { - border: 2px solid #cf9; -} diff --git a/src/components/todoStuff/todoTable.jsx b/src/components/todoStuff/todoTable.jsx deleted file mode 100644 index 4882627..0000000 --- a/src/components/todoStuff/todoTable.jsx +++ /dev/null @@ -1,57 +0,0 @@ -import React from 'react' - -import TodoRow from './todoRow' - -import styles from './todoTable.module.css' - -export default function TodoBoard(props) { - const { tables, cards, userId, categories, onClick, selectedGroup } = props - - return ( -
-
- {Object.keys(tables).map((key) => { - const table = tables[key] - - const tableCards = cards.filter((card) => { - return card.state === key - }) - - const tableCardsToShow = tableCards.filter((card) => { - const shouldHide = - card.state !== key || - (selectedGroup !== null && - selectedGroup !== 'uncat' && - card.group !== selectedGroup) || - (selectedGroup === 'uncat' && card.group !== undefined) - - return !shouldHide - }) - - return ( -
-
{table.name}
-
- {tableCardsToShow.length === 0 && ( -
Üres
- )} - {tableCardsToShow.map((card, i) => { - return ( - - ) - })} -
-
- ) - })} -
-
- ) -} diff --git a/src/components/todoStuff/todoTable.module.css b/src/components/todoStuff/todoTable.module.css deleted file mode 100644 index 23f933d..0000000 --- a/src/components/todoStuff/todoTable.module.css +++ /dev/null @@ -1,33 +0,0 @@ -.tableContainer { - overflow-y: hidden; - overflow-x: auto; - margin: 5px 0px; -} - -.table { - justify-content: center; -} - -.container { - flex-direction: column; - margin-top: 30px; - margin-bottom: 50px; -} - -.title { - text-align: center; - font-size: 20px; - font-weight: bold; -} - -.scroll { - max-height: 500px; - overflow-y: auto; - overflow-x: hidden; -} - -.empty { - display: flex; - justify-content: center; - padding: 10px 0px; -} diff --git a/src/components/todoStuff/todos.jsx b/src/components/todoStuff/todos.jsx deleted file mode 100644 index 0fbf303..0000000 --- a/src/components/todoStuff/todos.jsx +++ /dev/null @@ -1,227 +0,0 @@ -import React, { useState, useEffect } from 'react' - -import LoadingIndicator from '../LoadingIndicator' -import TodoBoard from './todoBoard' -import TodoTable from './todoTable' -import TodoSidebar from './todoSidebar' -import Modal from '../modal' - -import styles from './todo.module.css' -import constants from '../../constants.json' - -const byVotes = (a, b) => { - return b.votes.length - a.votes.length -} - -export default function Todos({ globalState, setGlobalState }) { - const [loaded, setLoaded] = useState(false) - const [columns, setColumns] = useState(null) - const [cards, setCards] = useState(null) - const [categories, setCategories] = useState(null) - const [userId, setUserId] = useState(null) - const [sidebarCard, setSidebarCard] = useState(null) - const [namedGroups, setGroups] = useState(null) - const [selectedGroup, setSelectedGroup] = useState(null) - - const [activeGroups, setActiveGroups] = useState(null) - - useEffect(() => { - if (globalState.todos) { - setTodos(globalState.todos) - } else { - fetch(`${constants.apiUrl}todos`, { - credentials: 'include', - }) - .then((resp) => { - return resp.json() - }) - .then((data) => { - setTodos(data) - setGlobalState({ - todos: data, - }) - }) - } - }, []) - - const setTodos = (data) => { - setCategories(data.todos.categories) - setGroups(data.todos.groups) - setUserId(data.userId) - - setCards(data.todos.cards) - setColumns(data.todos.columns) - setLoaded(true) - - const notTables = Object.keys(data.todos.columns).reduce((acc, key) => { - const col = data.todos.columns[key] - if (col.type !== 'table') { - acc.push(key) - } - return acc - }, []) - - setActiveGroups( - data.todos.cards.reduce((acc, card) => { - if (card.group && notTables.includes(card.state)) { - if (!acc.includes(card.group)) acc.push(card.group) - } - return acc - }, []) - ) - } - - const onClick = (card) => { - setSidebarCard(card.id) - } - - if (!loaded) { - return - } - - let bCards = [] - let tCards = [] - cards.forEach((card) => { - if (columns[card.state].type === 'table') { - tCards.push(card) - } else { - bCards.push(card) - } - }) - bCards = bCards.sort(byVotes) - tCards = tCards.sort(byVotes) - - let cols = {} - let tables = {} - Object.keys(columns).forEach((key) => { - const col = columns[key] - if (col.type !== 'table') { - cols = { - ...cols, - [key]: col, - } - } else { - tables = { - ...tables, - [key]: col, - } - } - }) - - const groups = cards.reduce((acc, card) => { - if (!acc.includes(card.group) && card.group) { - acc.push(card.group) - } - return acc - }, []) - - const renderGrouper = () => { - const sg = namedGroups[selectedGroup] - return ( - <> -
- {groups.map((group) => { - const namedGroup = namedGroups[group] - const shouldSkip = activeGroups && !activeGroups.includes(group) - - if (shouldSkip) { - return null - } - - return ( -
{ - setSelectedGroup(group) - }} - > - {namedGroup ? namedGroup.name : group} -
- ) - })} -
{ - setSelectedGroup('uncat') - }} - > - {'Kategorizálatlan'} -
-
{ - setSelectedGroup(null) - }} - > - {'Összes'} -
-
- {sg && sg.description ? ( -
{sg.description}
- ) : null} - - ) - } - - return ( -
- {sidebarCard && ( - { - setSidebarCard(null) - }} - > - { - return card.id === sidebarCard - })} - userId={userId} - categories={categories} - columns={columns} - namedGroups={namedGroups} - voteOn={(card) => { - fetch(`${constants.apiUrl}voteTodo?id=${card.id}`, { - credentials: 'include', - }) - .then((resp) => { - return resp.json() - }) - .then((data) => { - setTodos(data) - setGlobalState({ - todos: data, - }) - }) - }} - /> - - )} - {renderGrouper()} -
- - -
-
- ) -} diff --git a/src/components/todoStuff/todos.module.css b/src/components/todoStuff/todos.module.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/constants.js b/src/constants.js new file mode 100644 index 0000000..ae47948 --- /dev/null +++ b/src/constants.js @@ -0,0 +1,15 @@ +// eslint-disable-next-line no-undef +const useLocalhost = process && process.env.NODE_ENV === 'development' + +const constants = { + siteUrl: !useLocalhost ? 'http://frylabs.net/' : 'http://localhost:8080/', + apiUrl: !useLocalhost + ? 'http://frylabs.net/api/' + : 'http://localhost:8080/api/', + chatUrl: !useLocalhost ? 'http://frylabs.net/' : 'http://localhost:8080/', + mobileWindowWidth: 700, + maxQuestionsToRender: 250, + imageExts: ['gif', 'png', 'jpeg', 'jpg'], + videoExts: ['mp4', 'mkv', 'webm'], +} +export default constants diff --git a/src/constants.json b/src/constants.json deleted file mode 100644 index 44a21ed..0000000 --- a/src/constants.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "siteUrl": "https://qmining.frylabs.net/", - "apiUrl": "https://api.frylabs.net/", - "mobileWindowWidth": 700, - "maxQuestionsToRender": 250, - "imageExts" : ["gif", "png", "jpeg", "jpg"], - "videoExts" : ["mp4", "mkv", "webm"] -} diff --git a/src/data/tabs.json b/src/data/tabs.json index 7ebbabd..cdd986f 100644 --- a/src/data/tabs.json +++ b/src/data/tabs.json @@ -1,11 +1,7 @@ { "index": { "href": "/", - "text": "Fórum" - }, - "news": { - "href": "/news", - "text": "Hírek" + "text": "Főoldal" }, "script": { "href": "/script", @@ -26,5 +22,9 @@ "contact": { "href": "/contact", "text": "Kapcsolat" + }, + "p2pinfo": { + "href": "/p2pinfo", + "text": "P2P infó" } } diff --git a/src/data/topBarLinks.json b/src/data/topBarLinks.json index 9e3eb7c..7bcf712 100644 --- a/src/data/topBarLinks.json +++ b/src/data/topBarLinks.json @@ -1,12 +1,12 @@ { - "contribute": { - "href": "/contribute", - "text": "Teendők" - }, "pwRequest": { "href": "/pwRequest", "text": "Jelszó kérés" }, + "validation": { + "href": "/validation", + "text": "Validálás" + }, "ranklist": { "href": "/ranklist", "text": "Ranklista" diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index 60869d0..f04bd83 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -5,7 +5,7 @@ import Head from 'next/head' import Layout from '../components/layout' import '../defaultStyles.css' -import constants from '../constants.json' +import constants from '../constants' export const queryClient = new QueryClient({ defaultOptions: { diff --git a/src/pages/allQuestions.jsx b/src/pages/allQuestions.jsx index ea36d19..ab24250 100644 --- a/src/pages/allQuestions.jsx +++ b/src/pages/allQuestions.jsx @@ -10,7 +10,7 @@ import SearchBar from '../components/searchBar' import styles from './allQuestions.module.css' -import constants from '../constants.json' +import constants from '../constants' const countReducer = (acc, subj) => { return acc + subj.Questions.length diff --git a/src/pages/chat.jsx b/src/pages/chat.jsx index 87036a3..4e6e5b5 100644 --- a/src/pages/chat.jsx +++ b/src/pages/chat.jsx @@ -2,7 +2,7 @@ import React from 'react' import io from 'socket.io-client' import linkifyString from 'linkify-string' -import constants from '../constants.json' +import constants from '../constants' import LoadingIndicator from '../components/LoadingIndicator' import { queryClient } from '../pages/_app' import Header from '../components/header' @@ -202,7 +202,7 @@ export default class Chat extends React.Component { return } // https://socket.io/docs/v4/handling-cors/#Configuration - const socket = io(`${constants.apiUrl}`, { + const socket = io(`${constants.chatUrl}`, { withCredentials: true, extraHeaders: { 'qmining-chat': 'qmining-chat', diff --git a/src/pages/contact.jsx b/src/pages/contact.jsx index 45e3511..abc629f 100644 --- a/src/pages/contact.jsx +++ b/src/pages/contact.jsx @@ -3,7 +3,7 @@ import Link from 'next/link' import Header from '../components/header' import FeedbackArea from '../components/feedbackArea' -import constants from '../constants.json' +import constants from '../constants' import LoadingIndicator from '../components/LoadingIndicator' import styles from './contact.module.css' @@ -62,13 +62,10 @@ export default function Contact({ globalState, setGlobalState }) {
{contacts ? ( <> -
-
Alternatív módok
-
- Az alábbi módokat is nyugodtan használhatod, a nevedet, e-mail - címedet, illetve semmilyen egyéb adatot nem adok ki harmadik fél - számára. (egyedül én fogom látni) -
+
+ Figyelem! A szerver üzemeltetőjének kontaktját a + {'"P2P infó"'} + részlegen találod!
{Object.keys(contacts).map((key) => { @@ -78,8 +75,7 @@ export default function Contact({ globalState, setGlobalState }) {
{description}
{href ? ( - {' '} - {value}{' '} + {value} ) : (
{value}
@@ -94,5 +90,5 @@ export default function Contact({ globalState, setGlobalState }) { )}
- ); + ) } diff --git a/src/pages/contribute.jsx b/src/pages/contribute.jsx deleted file mode 100644 index 375edaa..0000000 --- a/src/pages/contribute.jsx +++ /dev/null @@ -1,91 +0,0 @@ -import React, { useState } from 'react' - -import Todos from '../components/todoStuff/todos' -import FeedbackArea from '../components/feedbackArea' -import Modal from '../components/modal' -import Header from '../components/header' - -import constants from '../constants.json' -import styles from './contribute.module.css' -import repos from '../data/repos.json' - -export default function Contribute({ globalState, setGlobalState }) { - const [showFeedback, setShowFeedback] = useState(false) - - return ( -
-
-
-

Teendők

-
-
-

- Ezen az oldalon új ötleteket adhatsz hozzá megvalósításra a teendők - listájához. -

-

- Emellet ha hozzáértő vagy, adott feladatok megvalósításában is - segíthetsz. (lásd: lentebb) -
Ha egy kártyára kattintasz, a megjelenő ablakban láthatod annak - részleteit, illetve{' '} - - szavazhatsz - {' '} - is a feladatra, annak érdekében, hogy minél hamarabb megvalósulhasson. - Minél több szavazat érkezik egy kártyára, annál magasabb lesz a - prioritása. (értsd: a legtöbb szavazatot kapó kártya teendője lesz - legelőször megvalósítva) -
A kurzort az oszlopcímekre mozgatva, további információkat - olvashatsz a kategóriák tulajdonságairól. -

-
-
-
{ - setShowFeedback(true) - }} - > - Új feladat -
-
-
-
- -
-
-
-
- Git repos -
-
- {Object.keys(repos.repos).map((key) => { - let repo = repos.repos[key] - return ( - - ) - })} -
-
- -
-
- {showFeedback && ( - { - setShowFeedback(false) - }} - > - - - )} -
- ) -} diff --git a/src/pages/contribute.module.css b/src/pages/contribute.module.css deleted file mode 100644 index 99f0cb8..0000000 --- a/src/pages/contribute.module.css +++ /dev/null @@ -1,32 +0,0 @@ -.warning { - color: white; - padding: 10px; - font-size: 26px; - text-align: center; -} - -.title { - color: var(--text-color); - font-size: 30px; - text-align: center; -} - -.gitRepos { - display: flex; - justify-content: space-around; -} - -@media screen and (max-width: 700px) { - .gitRepos { - flex-direction: column; - } -} - -.gitRepos a { - margin: 0px 5px; -} - -.gitRepos img { - width: 400px; - max-width: 90%; -} diff --git a/src/pages/faq.jsx b/src/pages/faq.jsx index dc5d74e..59849dd 100644 --- a/src/pages/faq.jsx +++ b/src/pages/faq.jsx @@ -3,7 +3,7 @@ import Link from 'next/link' import Header from '../components/header' -import constants from '../constants.json' +import constants from '../constants' import styles from './faq.module.css' function PasswordSection() { @@ -90,11 +90,7 @@ function FAQSection() { (így nicknevek sem kellenek), és még IP cím sincs sehol letárolva szerver oldalon.
- Több infó a{' '} - - kockázatok résznél - - . + Több infó a kockázatok résznél.
  • Ki és miért csinálja ezt a weboldalt? @@ -108,130 +104,130 @@ function FAQSection() {
  • - ); + ) } function RiskSection() { - return <> - Itt {'"én"'} alatt a szerver, weboldal és script egyedüli üzemeltetője - értendő, az egyetlen személy, aki hozzáfér akármilyen szolgáltatással - kapcsolatos adathoz, pl.: szerver statisztikák, szerver operációs - rendszere, beküldött fájlok. A weboldalon a felhasználó azonosítója:{' '} - #1 -
      -
    • - Beküldött fájlok kezeléseA beküldött fájlokban szerepelhet - személyes adat, pl.: név. Ha ilyen információval találkozok, akkor azt - ki szoktam törölni. Ezekhez a fájlokhoz és információkhoz csak én - férek hozzá, és sehova sincs kiadva. Ezek az információk nincsenek - sehol gyűjtve. -
    • -
    • - - Ha esetleg {'"'}lebukik{'"'} a szerver, és tárolt személyes infók - - Semmi személyes információ nincs eltárolva szerveren. Egyedüli - információ amit egyáltalán ki tudnék deríteni az amúgy is az IP címed, - de az nincs letárolva. Ha nagyon gonosz lennék, akkor a script el - tudná küldeni a neved és talán még 1-2 adatot a szervernek, de ezt nem - teszi. -

      - Bizonyíték? A script, weboldal és szerver teljesen nyílt forráskódú,{' '} - - ezek repository-ja publikus - {' '} - (contribute oldal alja), és akármikor felülvizsgálható. A script a te - böngésződben fut, tampermonkey bővítmény menüjében megtekinthető - milyen kód fut pontosan. -

    • -
    • - Bármikor észrevehetik hogy használod a scriptetA weboldalt már - kevésbé, de úgy nem menti el a kérdéseket a script, mert nem fut.{' '} - - Manuálisan is be lehet küldeni kérdés-válaszokat. - -

      - A script shadow-root hoz teszi hozzá az összes megjelenített - elementet, így ezeket szinte lehetetlen detektálni. A moodle - semmiféleképpen nem látja, hogy milyen más oldalak vannak megnyitva a - böngésződben. Nem látja az XMLHttp requesteket se, amit a script - végez. Egy Matomo nevű script látja hogy milyen oldalakra navigálsz a - moodle-ről, de a script nem linkekkel irányít át, hanem javascript - eseménnyel, amit nem tud nyomon követni. -

      - Aztán ki tudja ténylegesen hogy lehet -

    • -
    • - Bármikor leállhat a szerver - És akkor nem bírod megnézni a válaszokat. Erre van az{' '} - - összes kérdés TXT - -
    • -
    • - Akármelyik válasz rossz lehet - Pl.: ha a script rosszul menti le, vagy rossz kérdésre ad választ -
    • -
    - ; + return ( + <> + Itt {'"én"'} alatt a szerver, weboldal és script egyedüli üzemeltetője + értendő, az egyetlen személy, aki hozzáfér akármilyen szolgáltatással + kapcsolatos adathoz, pl.: szerver statisztikák, szerver operációs + rendszere, beküldött fájlok. A weboldalon a felhasználó azonosítója:{' '} + #1 +
      +
    • + Beküldött fájlok kezeléseA beküldött fájlokban szerepelhet + személyes adat, pl.: név. Ha ilyen információval találkozok, akkor azt + ki szoktam törölni. Ezekhez a fájlokhoz és információkhoz csak én + férek hozzá, és sehova sincs kiadva. Ezek az információk nincsenek + sehol gyűjtve. +
    • +
    • + + Ha esetleg {'"'}lebukik{'"'} a szerver, és tárolt személyes infók + + Semmi személyes információ nincs eltárolva szerveren. Egyedüli + információ amit egyáltalán ki tudnék deríteni az amúgy is az IP címed, + de az nincs letárolva. Ha nagyon gonosz lennék, akkor a script el + tudná küldeni a neved és talán még 1-2 adatot a szervernek, de ezt nem + teszi. +

      + Bizonyíték? A script, weboldal és szerver teljesen nyílt forráskódú,{' '} + + ezek repository-ja publikus + {' '} + (contribute oldal alja), és akármikor felülvizsgálható. A script a te + böngésződben fut, tampermonkey bővítmény menüjében megtekinthető + milyen kód fut pontosan. +

    • +
    • + Bármikor észrevehetik hogy használod a scriptetA weboldalt már + kevésbé, de úgy nem menti el a kérdéseket a script, mert nem fut.{' '} + + Manuálisan is be lehet küldeni kérdés-válaszokat. + +

      + A script shadow-root hoz teszi hozzá az összes megjelenített + elementet, így ezeket szinte lehetetlen detektálni. A moodle + semmiféleképpen nem látja, hogy milyen más oldalak vannak megnyitva a + böngésződben. Nem látja az XMLHttp requesteket se, amit a script + végez. Egy Matomo nevű script látja hogy milyen oldalakra navigálsz a + moodle-ről, de a script nem linkekkel irányít át, hanem javascript + eseménnyel, amit nem tud nyomon követni. +

      + Aztán ki tudja ténylegesen hogy lehet +

    • +
    • + Bármikor leállhat a szerver + És akkor nem bírod megnézni a válaszokat. Erre van az{' '} + + összes kérdés TXT + +
    • +
    • + Akármelyik válasz rossz lehet + Pl.: ha a script rosszul menti le, vagy rossz kérdésre ad választ +
    • +
    + + ) } function WebsiteSaveSection() { - return <> -

    - Ha hibát találsz, kérlek jelents. Hogy a hibákat a saját gépemen - reprodukálni tudjam, és könnyen ki bírjam javítani, sokszor jól jön, ha - egy lementett weboldalt megkapok, amin a hiba történik. Így lehet - menteni egy oldalt: -

    -
      -
    • - Lementett oldalon jobb klikk, oldal mentése -
      - img -
    • -
    • - A lementett oldal egy fájlból és mappából áll. -
      - img -
    • -
    • - A fájlt nyisd meg szövegszerkesztővel (notepad), és keress rá a - nevedre, majd (csak a neved, ne a sort) töröld ki, és mentsd el. Nem - szoktam megnézni a neveket, nem is tudok velük mit kezdeni, és nem is - adom ki soha. Amit beküldesz, azt csak én látom.{' '} - - Több infó itt - {' '} -
    • -
    • - - Ide tudod feltölteni - {' '} -
    • -
    -

    - Mivel nincs hozzáférésem semmilyen egyetemi oldalhoz, így csak így tudom - hatékonyan tesztelni a scriptet. Ezért hatalmas segítség ha feltöltöd - azt az oldalt amin hibával találkozol. -

    - ; + return ( + <> +

    + Ha hibát találsz, kérlek jelents. Hogy a hibákat a saját gépemen + reprodukálni tudjam, és könnyen ki bírjam javítani, sokszor jól jön, ha + egy lementett weboldalt megkapok, amin a hiba történik. Így lehet + menteni egy oldalt: +

    +
      +
    • + Lementett oldalon jobb klikk, oldal mentése +
      + img +
    • +
    • + A lementett oldal egy fájlból és mappából áll. +
      + img +
    • +
    • + A fájlt nyisd meg szövegszerkesztővel (notepad), és keress rá a + nevedre, majd (csak a neved, ne a sort) töröld ki, és mentsd el. Nem + szoktam megnézni a neveket, nem is tudok velük mit kezdeni, és nem is + adom ki soha. Amit beküldesz, azt csak én látom.{' '} + Több infó itt{' '} +
    • +
    • + Ide tudod feltölteni{' '} +
    • +
    +

    + Mivel nincs hozzáférésem semmilyen egyetemi oldalhoz, így csak így tudom + hatékonyan tesztelni a scriptet. Ezért hatalmas segítség ha feltöltöd + azt az oldalt amin hibával találkozol. +

    + + ) } function ScriptSection() { @@ -240,9 +236,7 @@ function ScriptSection() {
    • Hogy kell a scriptet telepíteni, és milyen oldalakon működik? - - Ezen az oldalon van leírva - {' '} + Ezen az oldalon van leírva{' '}
    • Hogyan működik a script? @@ -258,10 +252,7 @@ function ScriptSection() {
    • Más felhasználóknak köszönhetően már valószínűleg lesznek - megoldások a tesztjeidhez.{' '} - - Itt - {' '} + megoldások a tesztjeidhez. Itt{' '} meg tudod tekinteni, hogy vannak-e válaszok a tárgyadhoz.
    • @@ -378,77 +369,74 @@ function ScriptSection() {
    - ); + ) } function AddSite() { - return <> - Jelenleg az, hogy a script melyik oldalakon fut bele van égetve a script - forráskódjába. Ez itt látható:{' '} - - stable.user.js#L52 - - {'. '} - Ez azért van így, hogy biztos csak olyan oldalakon fusson a script amit - támogat is. -

    - Ehhez persze kézzel hozzá lehet adni ideiglenesen bármilyen oldalt, hogy - kipróbáld ott működik-e. Akár működik, akár nem kérlek szólj, és frissítem - a scriptet hogy azon a domainen is fusson és működjön alapból. -

    - Egyetem moodle oldalának hozzáadása a scripthez kézzel: -

      -
    • - - Először telepítsd a scriptet rendesen - {' '} -
    • -
    • - Böngészőben nyisd meg a Tampermonkey bővítményt
      - -
      - Itt kattints a Dashboard-ra. -
    • -
    • - Keresd meg a scriptet, majd kattints rá: -
      - -
    • -
    • - A felugró szerkesztőben keresd meg a következő sorokat: -
      - -
    • -
    • - Itt az egyik @match ... sor után egy új sorban írd be az - egyetemed moodle oldalának címét. Ha ez a cím pl.:{' '} - https://moodle.egyetem.hu/main/akármi, akkor a következőre írd - át: https://moodle.egyetem.hu/*. Fenti képen látsz néhány - példát. A {'"*"'} a végén fontos! -
    • -
    • - Ezután mentsd el (ctrl + s, vagy file {'->'} save). Ha minden jól - ment, akkor elég frissíteni a moodle oldalát, és a script futni fog - rajta. Ezek után azon az oldalon amit beírtál meg kell jelennie a - Tampermonkey menüjében is: -
      - -
    • -
    • - Ha a tesztek közben mégsem megy, akkor ellenőrizd, hogy a beírt moodle - cím egyezik-e a teszt közbenivel. Ha kell egy kis segítség, kérdésed - van, nem működik valami, vagy éppen működik, de alapból nincs - hozzáadva:{' '} - - írj a kapcsolat oldalon! - -
    • -
    - ; + return ( + <> + Jelenleg az, hogy a script melyik oldalakon fut bele van égetve a script + forráskódjába. Ez itt látható:{' '} + + stable.user.js#L52 + + {'. '} + Ez azért van így, hogy biztos csak olyan oldalakon fusson a script amit + támogat is. +

    + Ehhez persze kézzel hozzá lehet adni ideiglenesen bármilyen oldalt, hogy + kipróbáld ott működik-e. Akár működik, akár nem kérlek szólj, és frissítem + a scriptet hogy azon a domainen is fusson és működjön alapból. +

    + Egyetem moodle oldalának hozzáadása a scripthez kézzel: +

      +
    • + Először telepítsd a scriptet rendesen{' '} +
    • +
    • + Böngészőben nyisd meg a Tampermonkey bővítményt
      + +
      + Itt kattints a Dashboard-ra. +
    • +
    • + Keresd meg a scriptet, majd kattints rá: +
      + +
    • +
    • + A felugró szerkesztőben keresd meg a következő sorokat: +
      + +
    • +
    • + Itt az egyik @match ... sor után egy új sorban írd be az + egyetemed moodle oldalának címét. Ha ez a cím pl.:{' '} + https://moodle.egyetem.hu/main/akármi, akkor a következőre írd + át: https://moodle.egyetem.hu/*. Fenti képen látsz néhány + példát. A {'"*"'} a végén fontos! +
    • +
    • + Ezután mentsd el (ctrl + s, vagy file {'->'} save). Ha minden jól + ment, akkor elég frissíteni a moodle oldalát, és a script futni fog + rajta. Ezek után azon az oldalon amit beírtál meg kell jelennie a + Tampermonkey menüjében is: +
      + +
    • +
    • + Ha a tesztek közben mégsem megy, akkor ellenőrizd, hogy a beírt moodle + cím egyezik-e a teszt közbenivel. Ha kell egy kis segítség, kérdésed + van, nem működik valami, vagy éppen működik, de alapból nincs + hozzáadva: írj a kapcsolat oldalon! +
    • +
    + + ) } const pages = { diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 6b7501d..8c4f74c 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -25,12 +25,11 @@ export default function UserForum({
    )} ) diff --git a/src/pages/memes.jsx b/src/pages/memes.jsx index 9203f96..ce9ab7e 100644 --- a/src/pages/memes.jsx +++ b/src/pages/memes.jsx @@ -9,7 +9,7 @@ import Composer from '../components/composer' import Modal from '../components/modal' import styles from './memes.module.css' -import constants from '../constants.json' +import constants from '../constants' const forumPostPerPage = 5 const frontpageForumName = 'memes' diff --git a/src/pages/news.jsx b/src/pages/news.jsx deleted file mode 100644 index ccb5e74..0000000 --- a/src/pages/news.jsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react' - -import Forum from '../components/forum' - -export default function Index({ - router, - globalData, - globalState, - setGlobalState, -}) { - return ( - - ) -} diff --git a/src/pages/news.module.css b/src/pages/news.module.css deleted file mode 100644 index 8a5e7d3..0000000 --- a/src/pages/news.module.css +++ /dev/null @@ -1,21 +0,0 @@ -.title { - color: var(--text-color); - font-size: 32px; - text-align: center; - letter-spacing: 2.5px; -} - -.motd { - text-align: center; - font-size: 20px; - - border: 2px dashed var(--text-color); - padding-top: 13px; - padding-bottom: 15px; - padding-left: 5px; - padding-right: 5px; - margin-top: 18px; - margin-bottom: 30px; - margin-left: 5px; - margin-right: 5px; -} diff --git a/src/pages/p2pinfo.jsx b/src/pages/p2pinfo.jsx new file mode 100644 index 0000000..6df4c1f --- /dev/null +++ b/src/pages/p2pinfo.jsx @@ -0,0 +1,184 @@ +import React, { useState, useEffect } from 'react' +import Link from 'next/link' + +import Header from '../components/header' +import constants from '../constants' +import LoadingIndicator from '../components/LoadingIndicator' + +import styles from './p2pinfo.module.css' + +const infos = [ + { + title: 'Név', + key: 'name', + }, + { + title: 'Kontakt', + key: 'contact', + }, + { + title: 'Utolsó szinkronizálás', + key: 'lastSync', + type: 'date', + }, + { + title: 'Kérdés DB-k', + key: 'questionDbCount', + type: 'number', + }, + { + title: 'Tárgyak', + key: 'subjectCount', + type: 'number', + }, + { + title: 'Kérdések', + key: 'questionCount', + type: 'number', + }, + { + title: 'Script version', + key: 'scriptVersion', + }, + { + title: 'Szerver build time', + key: 'serverBuildTime', + type: 'date', + }, + { + title: 'Weboldal build time', + key: 'qminingPageBuildTime', + type: 'date', + }, + { + title: 'Data editor build time', + key: 'dataEditorBuildTime', + type: 'date', + }, + { + title: 'Szerver revision', + key: 'serverRevision', + }, + { + title: 'Script revision', + key: 'scriptRevision', + }, + { + title: 'Weboldal revision', + key: 'qminingPageRevision', + }, + { + title: 'Data editor revision', + key: 'dataEditorRevision', + }, +] + +export default function P2PInfo({ globalState, setGlobalState }) { + const [p2pInfo, setP2pinfo] = useState() + const info = p2pInfo + ? { + ...p2pInfo, + ...p2pInfo.selfInfo, + ...p2pInfo.qdbInfo, + } + : {} + + useEffect(() => { + if (globalState.p2pinfo) { + setP2pinfo(globalState.p2pinfo) + } else { + fetch(constants.apiUrl + 'p2pinfo', { + method: 'GET', + credentials: 'include', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + }) + .then((res) => { + return res.json() + }) + .then((res) => { + setP2pinfo(res) + setGlobalState({ + p2pinfo: res, + }) + }) + } + }, []) + + if (!p2pInfo) return + + return ( + <> +
    +

    Peer to peer infó

    +
    +
    +
    +
    + A weboldal peer to peer (p2p) megoldást implementál, folyamatosan + megosztja az új kérdéseket a lent megadott regisztrált szerverekkel, + és hozzáadja a kapott új kérdéseket a helyi adatbázishoz. +

    + Ha az egyik szerver kiesne, a script a megadott szerverek közül + választ egy újat. A felhasználók is szinkronizálva vannak, így a + jelenlegi jelszavaddal bármelyik másik oldalra be tudsz lépni +

    A szervert akár te is hostolhatod, érdeklődj a lentebb megadott + kontakton +

    +
    +
    Szerver P2P információja:
    +
    + {infos.map((x) => { + const { title, key, type } = x + + let text = info[key] + switch (type) { + case 'date': + text = new Date(text).toLocaleString() + break + case 'number': + text = text.toLocaleString() + break + } + return ( +
    +
    {title}
    +
    {text}
    +
    + ) + })} +
    +
    Regisztrált peer-ek:
    +
    +
    Név
    +
    Host
    +
    Utolsó szinkronizálás
    +
    + {p2pInfo.myPeers.map((peer, i) => { + return ( +
    +
    {peer.name}
    + +
    {new Date(peer.lastSync).toLocaleString()}
    +
    + ) + })} + {p2pInfo.myPeers.length === 0 && ( +
    + Ennél a szervernél jelenleg nincs peer regisztrálva +
    + )} +
    + + ) +} diff --git a/src/pages/p2pinfo.module.css b/src/pages/p2pinfo.module.css new file mode 100644 index 0000000..7e87a88 --- /dev/null +++ b/src/pages/p2pinfo.module.css @@ -0,0 +1,44 @@ +.container { + padding: 10px; +} + +.infoRow { + display: flex; +} + +.infoRow > * { + padding: 0px 8px; + +} + +.infoRow :first-child { + flex: 1; + display: flex; + justify-content: flex-end; +} + +.infoRow :last-child { + flex: 2; + color: var(--text-color); +} + +.peerContainer, .peerHeader { + display: flex; + justify-content: space-around; + align-content: center; + padding: 5px 10px; +} + +.peerContainer { + color: var(--text-color); +} + +.peerContainer > *, .peerHeader > * { + flex: 1; +} + +.title { + color: var(--text-color); + font-size: 20px; + text-align: center; +} diff --git a/src/pages/pwRequest.jsx b/src/pages/pwRequest.jsx index 8d1ec3c..cef696b 100644 --- a/src/pages/pwRequest.jsx +++ b/src/pages/pwRequest.jsx @@ -4,7 +4,7 @@ import Link from 'next/link' import Header from '../components/header' import styles from './pwRequest.module.css' -import constants from '../constants.json' +import constants from '../constants' function fetchAvailablePWS() { return new Promise((resolve) => { @@ -107,10 +107,7 @@ export default function PwRequest({ globalData, globalState, setGlobalState }) { Minden felhasználó egyedi jelszót kap. Ne használjatok többen egy jelszót, mert egy idő után -biztonsági okokból- kidob a rendszer, ha ugyan az a felhasználó több helyen is belépve marad. A - jelszavakról bővebben a{' '} - - GYIK - {' '} + jelszavakról bővebben a GYIK{' '} vonatkozó részében olvashatsz.

    @@ -191,5 +188,5 @@ export default function PwRequest({ globalData, globalState, setGlobalState }) { - ); + ) } diff --git a/src/pages/ranklist.jsx b/src/pages/ranklist.jsx index f56bf98..b5cbf36 100644 --- a/src/pages/ranklist.jsx +++ b/src/pages/ranklist.jsx @@ -4,7 +4,7 @@ import Header from '../components/header' import LoadingIndicator from '../components/LoadingIndicator' import styles from './ranklist.module.css' -import constants from '../constants.json' +import constants from '../constants' const selectOptions = { newQuestions: { name: 'Beküldött új kérdések' }, diff --git a/src/pages/script.jsx b/src/pages/script.jsx index 7135ca0..26172e7 100644 --- a/src/pages/script.jsx +++ b/src/pages/script.jsx @@ -4,7 +4,7 @@ import { useQuery } from 'react-query' import Header from '../components/header' import Link from 'next/link' -import constants from '../constants.json' +import constants from '../constants' import ExternalLinkIcon from '../components/externalLinkIcon' import styles from './script.module.css' @@ -102,13 +102,9 @@ export default function Script() {
  • Ha be vagy jelentkezve, akkor a teszt oldalakon a megoldásokat kellene látnod egy felugró ablakban felül. Ha nem, akkor{' '} - - GYIK - + GYIK -be olvass bele, vagy{' '} - - írj üzenetet mi nem működik - + írj üzenetet mi nem működik
  • Példa felugró ablakokra: @@ -161,5 +157,5 @@ export default function Script() { - ); + ) } diff --git a/src/pages/thanks.jsx b/src/pages/thanks.jsx index 1e19253..38c0dd1 100644 --- a/src/pages/thanks.jsx +++ b/src/pages/thanks.jsx @@ -1,6 +1,6 @@ import React from 'react' import styles from './thanks.module.css' -import constants from '../constants.json' +import constants from '../constants' import Head from 'next/head' export default function Thanks() { diff --git a/src/pages/userfiles.jsx b/src/pages/userfiles.jsx index a7f610e..b82fc94 100644 --- a/src/pages/userfiles.jsx +++ b/src/pages/userfiles.jsx @@ -8,7 +8,7 @@ import UpDownVote from '../components/upDownVote' import Header from '../components/header' import styles from './userfiles.module.css' -import constants from '../constants.json' +import constants from '../constants' function vote(to, item) { return new Promise((resolve, reject) => { @@ -382,7 +382,11 @@ export default function UserFiles({
    {currDir && (
    { goBack() }} @@ -482,13 +486,14 @@ export default function UserFiles({ onClick={(e) => { e.stopPropagation() }} - className={'userId'}> + className={'userId'} + > {`#${user}`} ))}
    - ); + ) })} ) : ( @@ -513,7 +518,7 @@ export default function UserFiles({ )} - ); + ) } return ( @@ -535,10 +540,8 @@ export default function UserFiles({ vállalás nincs. {' '} Ha valami nem idevalót látsz, azt a{' '} - - Kapcsolat - {' '} - oldalon jelezd kérlek. Tudatos károkozásért ban jár. + Kapcsolat oldalon jelezd kérlek. Tudatos + károkozásért ban jár. )}
    @@ -602,5 +605,5 @@ export default function UserFiles({ )} - ); + ) } diff --git a/src/pages/validation.jsx b/src/pages/validation.jsx new file mode 100644 index 0000000..d47dc9e --- /dev/null +++ b/src/pages/validation.jsx @@ -0,0 +1,46 @@ +import React, { useState, useEffect } from 'react' + +import Header from '../components/header' + +import styles from './validation.module.css' +import constants from '../constants' + +function fetchValidation() { + return new Promise((resolve) => { + fetch(`${constants.apiUrl}validationtoken`, { + credentials: 'include', + }) + .then((resp) => { + return resp.json() + }) + .then((res) => { + resolve(res) + }) + }) +} + +export default function Validation() { + const [token, setToken] = React.useState('') + + useEffect(() => { + fetchValidation().then((res) => { + setToken(res.key) + }) + }, []) + + return ( +
    +
    +
    +

    Validálás

    +
    +
    +
    + Különböző okokból kellhet, hogy bizonyítsd hogy az oldalhoz van + hozzáférésed. Ebben az esetben ezzel a tokennel tudod: +
    + {token &&
    {token}
    } +
    +
    + ) +} diff --git a/src/pages/validation.module.css b/src/pages/validation.module.css new file mode 100644 index 0000000..04d3b45 --- /dev/null +++ b/src/pages/validation.module.css @@ -0,0 +1,16 @@ +.descrip { + color: #acabab; + font-weight: bold; + padding-top: 4%; + padding-bottom: 4%; + font-size: 20px; +} + +.tokenContainer { + font-family: 'Courier New', Courier, monospace; + text-align: center; + font-size: 24px; + color: white; + padding: 20px; + font-weight: bold; +}