Skip to content

Commit

Permalink
Merge pull request #175 from osamhack2021/hotfix/dashboard-request
Browse files Browse the repository at this point in the history
hotfix dashboard and detectionstatus page
  • Loading branch information
simonseo authored Oct 13, 2021
2 parents 34061a4 + e889d38 commit 9ebb777
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 17 deletions.
3 changes: 3 additions & 0 deletions WEB/frontend/src/components/Dashboard/ArticleVolumeLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import useFetch from '../../hooks/useFetch';

const ArticleVolumeLine = ({ theme, colors }) => {
const { data, isPending, error } = useFetch(`/data/articleVolume.json`);
// const { data, error, isPending } = useFetch(`/api/nlp/article/volume/`, {
// method: 'GET',
// });

return (
<Card style={{ height: '400px' }}>
Expand Down
8 changes: 4 additions & 4 deletions WEB/frontend/src/components/Dashboard/SentimentBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
} from '@mui/material';
import useFetch from '../../hooks/useFetch';


const SentimentBar = ({ theme, colors }) => {
const { data, error, isPending } = useFetch(`/api/nlp/sentiment/bar/`, {
method: 'POST',
});
const { data, error, isPending } = useFetch(`/data/sentimentBar.json`);
// const { data, error, isPending } = useFetch(`/api/nlp/sentiment/bar/`, {
// method: 'GET',
// });

return (
<Card style={{ height: '400px' }}>
Expand Down
7 changes: 4 additions & 3 deletions WEB/frontend/src/components/Dashboard/SentimentPie.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import {
import useFetch from '../../hooks/useFetch';

export const SentimentPie = ({ theme, colors }) => {
const { data, error, isPending } = useFetch(`/api/nlp/sentiment/pie/`, {
method: 'POST',
});
const { data, error, isPending } = useFetch(`/data/sentimentPie.json`);
// const { data, error, isPending } = useFetch(`/api/nlp/sentiment/pie/`, {
// method: 'GET',
// });

return (
<Card style={{ height: '400px' }}>
Expand Down
3 changes: 3 additions & 0 deletions WEB/frontend/src/components/Dashboard/TrendsCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ function CustomPagination() {

export default function TrendsCard() {
const { data, error, isPending } = useFetch(`/data/trends.json`);
// const { data, error, isPending } = useFetch(`/api/nlp/trends`, {
// method: 'GET',
// });

return (
<Card style={{ width: '100%', height: '400px' }}>
Expand Down
3 changes: 3 additions & 0 deletions WEB/frontend/src/components/Dashboard/WordCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import { useEffect } from 'react';

const WordCloud = ({ options }) => {
const { data, isPending, error } = useFetch(`/data/wordCloud.json`);
// const { data, error, isPending } = useFetch(`/api/nlp/wordcloud/`, {
// method: 'GET',
// });

return (
<Card
Expand Down
20 changes: 10 additions & 10 deletions WEB/frontend/src/pages/DetectionStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { useSessionStorage } from '../js/util';

import { useRecoilValue } from 'recoil';
import { searchState } from '../atoms/searchState';
import useSeacrhEffect from '../hooks/useSearchInitEffect';
import useSearchEffect from '../hooks/useSearchInitEffect';
import { appliedFilterListState } from '../atoms/appliedFilterMapState';

export default function DetectionStatus() {
useSeacrhEffect(); // init
useSearchEffect(); // init

const search = useRecoilValue(searchState);
const appliedFilterList = useRecoilValue(appliedFilterListState);
Expand All @@ -36,7 +36,7 @@ export default function DetectionStatus() {
const data = search.contents.filter((x) => x._id == _id).pop(0); // popping doesn't affect original array
console.log(
data,
search.contents.filter((x) => x.id == _id),
search.contents.filter((x) => x._id == _id),
search
);
setDetailModalData(data);
Expand All @@ -45,13 +45,13 @@ export default function DetectionStatus() {

const [getCart, addCart] = useSessionStorage('riskoutShoppingCart');
const { enqueueSnackbar } = useSnackbar();
const scrapArticle = (id) => {
addCart(id);
// const article = search.contents.filter((x) => x.id == id).pop();
// enqueueSnackbar('Scrapped article | ' + article.title, {
// variant: 'success',
// autoHideDuration: 10000,
// });
const scrapArticle = (_id) => {
addCart(_id);
const article = search.contents.filter((x) => x._id == _id).pop(0);
enqueueSnackbar('Scrapped article | ' + article.title, {
variant: 'success',
autoHideDuration: 10000,
});
};

const analyzePage = (id) => {
Expand Down

0 comments on commit 9ebb777

Please sign in to comment.