diff --git a/src/components/modal.module.css b/src/components/modal.module.css index a1a03e2..19aa27e 100644 --- a/src/components/modal.module.css +++ b/src/components/modal.module.css @@ -1,5 +1,5 @@ .modal { - z-index: 9999; + z-index: 99; position: fixed; top: 0; left: 0; diff --git a/src/components/newsEntry.js b/src/components/newsEntry.js index 96ae22d..88d0cdf 100644 --- a/src/components/newsEntry.js +++ b/src/components/newsEntry.js @@ -8,7 +8,8 @@ import styles from './newsEntry.module.css' export default function NewsEntry({ newsItem, uid, - onReact, + onCommentReact, + onNewsReact, onComment, onDelete, onPostDelete, @@ -19,19 +20,20 @@ export default function NewsEntry({
-
+
{title}
User #{user}
{date}
-
+ {admin ? ( +
+ ) : ( +
{content}
+ )}
{uid === user ? ( @@ -47,14 +49,14 @@ export default function NewsEntry({ existingReacts={reacts} uid={uid} onClick={(reaction, isDelete) => { - onReact({ type: 'news', reaction, isDelete }) + onNewsReact({ reaction, isDelete }) }} />
{ - onReact({ type: 'comment', path, reaction, isDelete }) + onCommentReact({ path, reaction, isDelete }) }} onComment={onComment} onDelete={onDelete} diff --git a/src/components/newsEntry.module.css b/src/components/newsEntry.module.css index 1594d3d..022fca8 100644 --- a/src/components/newsEntry.module.css +++ b/src/components/newsEntry.module.css @@ -1,6 +1,7 @@ .newsBody { margin: 0px 5px; color: #fff; + white-space: pre-line; } .newsTitle { diff --git a/src/components/reactButton.js b/src/components/reactButton.js index 11a4610..68c61f3 100644 --- a/src/components/reactButton.js +++ b/src/components/reactButton.js @@ -76,7 +76,6 @@ export default function ReactButton({ onClick, existingReacts, uid }) { onClick={() => { setOpened(true) }} - onMouseEnter={() => {}} onMouseLeave={() => { setOpened(false) }} diff --git a/src/components/tooltip.module.css b/src/components/tooltip.module.css index b7beba2..2f05f33 100644 --- a/src/components/tooltip.module.css +++ b/src/components/tooltip.module.css @@ -15,7 +15,7 @@ border-radius: 6px; padding: 5px; position: absolute; - z-index: 1; + z-index: 9999; bottom: 100%; left: 0%; margin-left: -60px; diff --git a/src/pages/index.js b/src/pages/index.js index a3a41ab..dfd4ac1 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -143,50 +143,50 @@ export default function Index({ globalData }) { setNews(res.news) }) }} - onReact={({ type, path, reaction, isDelete }) => { - if (type === 'news') { - fetch(constants.apiUrl + 'infos', { - method: 'POST', - credentials: 'include', - headers: { - Accept: 'application/json', - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - react: reaction, - newsKey: key, - isDelete: isDelete, - }), + onNewsReact={({ reaction, isDelete }) => { + fetch(constants.apiUrl + 'react', { + method: 'POST', + credentials: 'include', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + reaction: reaction, + newsKey: key, + isDelete: isDelete, + }), + }) + .then((res) => { + return res.json() }) - .then((res) => { - return res.json() - }) - .then((res) => { - setNews(res.news) - }) - } else if (type === 'comment') { - fetch(constants.apiUrl + 'comment', { - method: 'POST', - credentials: 'include', - headers: { - Accept: 'application/json', - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - type: 'reaction', - newsKey: key, - path: path, - reaction: reaction, - isDelete: isDelete, - }), + .then((res) => { + console.log(res) + setNews(res.news) + }) + }} + onCommentReact={({ path, reaction, isDelete }) => { + fetch(constants.apiUrl + 'react', { + method: 'POST', + credentials: 'include', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + type: 'reaction', + newsKey: key, + path: path, + reaction: reaction, + isDelete: isDelete, + }), + }) + .then((res) => { + return res.json() + }) + .then((res) => { + setNews(res.news) }) - .then((res) => { - return res.json() - }) - .then((res) => { - setNews(res.news) - }) - } }} onDelete={(path) => { fetch(constants.apiUrl + 'comment', {