Skip to content

Commit

Permalink
feat: add issues section (#390)
Browse files Browse the repository at this point in the history
* gql: add query to get count of total articles

* gql: add query to list all articles

* feat: add admin panel navigator

* feat: add admin panel header

* feat: add admin panel marginal

* feat: add category card

* feat: show logged in user profile pic

* chore: import hooks

* chore: destructure data

* feat: add authors card

* chore: change id type from string to int

* wip: add add categories function

* feat: add browse page

* feat: add mutation to create article

* feat: add query to list all user

* feat: add snack bar aleart

* chore: remove console log

* feat: add new article page

* chore: remove content component

* chore: add link to monday morning wesite in footer

* feat: show default users

* feat(graphql): add update article props

* feat(graphql): get restricted artcile data

* feat(graphql): add mutation to update article categories

* feat(graphql): add mutation to update article users

* feat: select default category

* chore: remove unuse import

* feat: add index page

* chore: remove console log

* feat: activate edit button

* feat: add media previewer

* wip: init image kit

* feat: add drop down

* feat(graphql): add mutation to update article cover

* feat(graphql): add mutation to add media

* wip: get cover media data

* feat: add loading indicator

* feat: add edit component

* feat: add media page and screen

* chore: sample content page

* wip: redirect to admin page after login

* feat: check permission

* feat: add error handling

* feat: update article publish status

* graphql: update article restriction

* feat(graphql): add update article approval status

* fix: get approval status

* feat: update article restriction and approval status

* feat: tags component

* feat: get podcast data (#356)

* chore: fix pritter issue (#359)

* fix: prettier format check (#360)

* chore: fix prettier issue

* fix: prettier format check

* fix: photostory import issue  (#362)

* wip:PhotoStory to _Photostory

* wip: _Photostory to Photostory

* fix: update yarn.lock

* feat: enable dynamic spotify embed (#364)

* feat: enable spotify

* feat: show dynamic embded

* feat(grpahql): add get latest issues

* feat: add issues screen

* feat: add issues page

* feat: add tabs in navigator

* chore: renmae context to ctx

* feat: basic integration of live page (#384)

* fix: add course list and disable till implementation

* fix: integrate data display

* chore: add session list

* feat: integrate live page

* chore: add dayjs mui/x-date-pickers

* feat: add issue date input

* feat: add issues graphql operations

* chore: remove console log

* feat: add issue article input component

* feat: add issue dialog box

* feat: add issues screen

Co-authored-by: Rutaj Dash <[email protected]>
  • Loading branch information
120EE0692 and rutajdash authored Jan 4, 2023
1 parent a52cc19 commit 99989c5
Show file tree
Hide file tree
Showing 32 changed files with 1,266 additions and 170 deletions.
6 changes: 4 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"start:prod": "next start",
"build": "next build",
"lint": "next lint",
"format:check": "prettier --list-different --config \"./client/.prettierrc\" --ignore-path \"./client/.prettierignore\" --no-error-on-unmatched-pattern \"./client/.\"",
"format": "prettier --write --config \"./client/.prettierrc\" --ignore-path \"./client/.prettierignore\" --no-error-on-unmatched-pattern \"./client/.\""
"format:check": "prettier --list-different --config \"./.prettierrc\" --ignore-path \"./.prettierignore\" --no-error-on-unmatched-pattern \"./.\"",
"format": "prettier --write --config \"./.prettierrc\" --ignore-path \"./.prettierignore\" --no-error-on-unmatched-pattern \"./.\""
},
"keywords": [],
"author": "",
Expand All @@ -23,7 +23,9 @@
"@mui/material": "^5.8.3",
"@mui/styles": "^5.8.3",
"@mui/system": "^5.8.5",
"@mui/x-date-pickers": "^5.0.12",
"chart.js": "^3.9.1",
"dayjs": "^1.11.7",
"dotenv": "^10.0.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
Expand Down
26 changes: 16 additions & 10 deletions client/src/assets/placeholder/live.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@ import brillio from '../images/live/Brillio.png';

export const LIVE = Object.freeze({
sessions: [
'Autumn 2020-21',
'Spring 2020-21',
'Autumn 2019-20',
'Spring 2019-20',
'Autumn 2018-19',
'Spring 2018-19',
'Autumn 2017-18',
'Spring 2017-18',
'Autumn 2016-17',
'Spring 2016-17',
// 'Spring 2023',
'Autumn 2022',
'Spring 2022',
'Autumn 2021',
'Spring 2021',
'Autumn 2020',
'Spring 2020',
'Autumn 2019',
'Spring 2019',
'Autumn 2018',
'Spring 2018',
'Autumn 2017',
'Spring 2017',
'Autumn 2016',
'Spring 2016',
'Autumn 2015',
],
departments: [
'All Departments',
Expand Down
26 changes: 22 additions & 4 deletions client/src/components/admin_v2/Marginals/Navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ import TimerIcon from '@mui/icons-material/Timer';
import SettingsIcon from '@mui/icons-material/Settings';
import PhonelinkSetupIcon from '@mui/icons-material/PhonelinkSetup';
import AddCircleIcon from '@mui/icons-material/AddCircle';
import PersonIcon from '@mui/icons-material/Person';
import ManageAccountsIcon from '@mui/icons-material/ManageAccounts';
import PollIcon from '@mui/icons-material/Poll';
import FeedIcon from '@mui/icons-material/Feed';
import NewspaperIcon from '@mui/icons-material/Newspaper';
import MarkUnreadChatAltIcon from '@mui/icons-material/MarkUnreadChatAlt';

const categories = [
{
Expand All @@ -30,11 +36,23 @@ const categories = [
],
},
{
id: 'Quality',
id: 'Website Settings',
children: [
{ id: 'Analytics', icon: <SettingsIcon /> },
{ id: 'Performance', icon: <TimerIcon /> },
{ id: 'Test Lab', icon: <PhonelinkSetupIcon /> },
{ id: 'issues', icon: <NewspaperIcon />, path: '/admin_v2/issues' },
{ id: 'squiggle', icon: <FeedIcon />, path: '/admin_v2/squiggle' },
{ id: 'poll', icon: <PollIcon />, path: '/admin_v2/poll' },
{
id: 'comment',
icon: <MarkUnreadChatAltIcon />,
path: '/admin_v2/comment',
},
],
},
{
id: 'Authentication',
children: [
{ id: 'User', icon: <PersonIcon /> },
{ id: 'Manage User', icon: <ManageAccountsIcon /> },
],
},
];
Expand Down
133 changes: 133 additions & 0 deletions client/src/components/admin_v2/issues/IssueArticleInput.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import React, { useState } from 'react';

import TextField from '@mui/material/TextField';
import Paper from '@mui/material/Paper';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemText from '@mui/material/ListItemText';
import IconButton from '@mui/material/IconButton';
import DeleteIcon from '@mui/icons-material/Delete';
import ListItemIcon from '@mui/material/ListItemIcon';
import Checkbox from '@mui/material/Checkbox';
import Typography from '@mui/material/Typography';

import useAutoComplete from '../../../hooks/useAutoComplete';

const IssueArticleInput = ({
articleList,
setArticlesList,
featuredArticle,
setFeaturedArticle,
}) => {
const [articleInput, setArticleInput] = useState('');

const articles = useAutoComplete(articleInput, 5);

return (
<div>
<Typography sx={{ fontSize: '25px', margin: '10px 0px' }} variant='h2'>
Articles this issue
</Typography>

<div style={{ display: 'flex', alignItems: 'center' }}>
<TextField
variant='outlined'
value={articleInput}
onChange={(e) => setArticleInput(e.target.value)}
placeholder='Search for articles'
fullWidth
/>
</div>
<Paper elevation={3} sx={{ zIndex: 1 }}>
{articleInput.length > 0 &&
articles?.map((article) => (
<div
style={{
padding: '5px 10px',
cursor: 'pointer',
borderBottom: '1px solid #ccc',
}}
key={article._id}
onClick={() => {
setArticlesList([...articleList, article]);
setArticleInput('');
}}
>
{article.title}
</div>
))}
</Paper>

<List>
{featuredArticle &&
featuredArticle?.map((article) => (
<ListItem key={article?.id}>
<ListItemIcon>
<Checkbox
defaultChecked={true}
onClick={() => {
setArticlesList([
...articleList,
...featuredArticle.filter((a) => a.id === article.id),
]),
setFeaturedArticle(
featuredArticle.filter((a) => a.id !== article.id),
);
}}
edge='start'
tabIndex={-1}
disableRipple
/>
</ListItemIcon>
<ListItemText primary={article?.title} />
<IconButton
onClick={() => {
setFeaturedArticle(
featuredArticle.filter((a) => a.id !== article.id),
);
}}
>
<DeleteIcon />
</IconButton>
</ListItem>
))}
</List>

<List>
{articleList &&
articleList?.map((article) => (
<ListItem key={article?.id}>
<ListItemIcon>
<Checkbox
onClick={() => {
setFeaturedArticle([
...featuredArticle,
...articleList.filter((a) => a.id === article.id),
]),
setArticlesList(
articleList.filter((a) => a.id !== article.id),
);
}}
edge='start'
tabIndex={-1}
disableRipple
/>
</ListItemIcon>
<ListItemText primary={article?.title} />
<IconButton
onClick={() => {
setArticlesList(
articleList.filter((a) => a.id !== article.id),
);
}}
>
<DeleteIcon />
</IconButton>
</ListItem>
))}
</List>
</div>
);
};

export default IssueArticleInput;
36 changes: 36 additions & 0 deletions client/src/components/admin_v2/issues/IssueDateInput.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React, { useState } from 'react';
import dayjs from 'dayjs';
import TextField from '@mui/material/TextField';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';

export default function IssueDateInput({
startDate,
setStartDate,
endDate,
setEndDate,
}) {
return (
<div style={{ marginTop: '20px' }}>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DateTimePicker
label='Start Date'
value={startDate}
onChange={(newValue) => {
setStartDate(newValue);
}}
renderInput={(params) => <TextField {...params} />}
/>
<DateTimePicker
label='End Date'
value={endDate}
onChange={(newValue) => {
setEndDate(newValue);
}}
renderInput={(params) => <TextField {...params} />}
/>
</LocalizationProvider>
</div>
);
}
Loading

0 comments on commit 99989c5

Please sign in to comment.