-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
32 changed files
with
1,266 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
133 changes: 133 additions & 0 deletions
133
client/src/components/admin_v2/issues/IssueArticleInput.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
Oops, something went wrong.