Skip to content

Commit

Permalink
Removed client-side markdown rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratstail91 committed Dec 30, 2021
1 parent 55ff576 commit 4e94c53
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 585 deletions.
10 changes: 0 additions & 10 deletions client/markdown/credits.md

This file was deleted.

4 changes: 0 additions & 4 deletions client/markdown/privacy-policy.md

This file was deleted.

5 changes: 2 additions & 3 deletions client/pages/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { TokenContext } from './utilities/token-provider';

//library components
import LazyRoute from './utilities/lazy-route';
import MarkdownPage from './utilities/markdown-page';

//styling
import '../styles/styles.css';
Expand Down Expand Up @@ -34,8 +33,8 @@ const App = props => {
<LazyRoute path='/admin' component={() => import('./administration/admin')} />
<LazyRoute path='/mod' component={() => import('./administration/mod')} />

<LazyRoute path='/privacypolicy' component={async () => () => <MarkdownPage content={require('../markdown/privacy-policy.md').default} />} />
<LazyRoute path='/credits' component={async () => () => <MarkdownPage content={require('../markdown/credits.md').default} />} />
<LazyRoute path='/privacypolicy' component={() => import('./static/privacy-policy')} />
<LazyRoute path='/credits' component={() => import('./static/credits')} />

<LazyRoute path='*' component={() => import('./not-found')} />
</Switch>
Expand Down
1 change: 0 additions & 1 deletion client/pages/dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import ApplyToBody from './utilities/apply-to-body';

import { TokenContext } from './utilities/token-provider';

import MarkdownPanel from './utilities/markdown-panel';
import Logout from './accounts/panels/logout';

const Dashboard = props => {
Expand Down
5 changes: 2 additions & 3 deletions client/pages/panels/news-feed.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { useState, useEffect, useRef } from 'react';
import dateFormat from 'dateformat';

import MarkdownPanel from '../utilities/markdown-panel';

const NewsFeed = props => {
const [articles, setArticles] = useState([]);
const aborter = useRef(new AbortController()); //BUGFIX: double-renders = double fetches + react update after unmount
Expand All @@ -29,6 +27,7 @@ const NewsFeed = props => {
<div className='panel'>
<h1 className='text centered'>News Feed</h1>
{articles.map((article, index) => {
console.log(article)
return (
<div key={index} className='panel'>
<hr />
Expand All @@ -40,7 +39,7 @@ const NewsFeed = props => {
<span>Published {dateFormat(article.createdAt, 'fullDate')}</span>
}</em></p>
<br />
<MarkdownPanel style={{whiteSpace: 'pre-wrap'}} content={article.body} />
<div dangerouslySetInnerHTML={{ __html: article.rendered }} />
</div>
);
})}
Expand Down
16 changes: 16 additions & 0 deletions client/pages/static/credits.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';

const Static = props => {
return (
<>
<header>
<h1 className='text centered'>Credits</h1>
</header>
<h2>MERN-template</h2>
<p>The <a href='https://github.com/krgamestudios/MERN-template'>MERN-template</a> developed by Kayne Ruse, KR Game Studios</p>
</>
);
};

export default Static;

12 changes: 12 additions & 0 deletions client/pages/static/privacy-policy.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

const Static = props => {
return (
<header>
<h1 className="text centered">Privacy Policy</h1>
</header>
);
};

export default Static;

22 changes: 0 additions & 22 deletions client/pages/utilities/markdown-page.jsx

This file was deleted.

35 changes: 0 additions & 35 deletions client/pages/utilities/markdown-panel.jsx

This file was deleted.

Loading

0 comments on commit 4e94c53

Please sign in to comment.