{"version":3,"sources":["constants/action_types.js","reducers/posts.js","reducers/index.js","styles.js","api/index.js","components/form/styles.js","components/form/form.js","actions/posts.js","components/postcontainer/posts/styles.js","components/postcontainer/posts/post/styles.js","components/postcontainer/posts/post/post.js","components/postcontainer/posts/posts.js","components/postcontainer/styles.js","components/postcontainer/postcontainer.js","app.js","index.js"],"names":["FETCH_ALL","POST","UPDATE","DELETE","SORT","post_handler","posts","action","type","payload","map","post","_id","filter","sorted_posts","hold","data","descending","sort","a","b","rating","console","log","combineReducers","makeStyles","theme","mainContainer","margin","padding","subContainer","url","fetchPosts","axios","get","createPost","post_data","updatePost","id","patch","deletePost","delete","paper","spacing","marginBottom","root_form","display","text_field","width","select","height","file_input_wrapper","file_input","Form","currentId","setCurrentId","useState","title","image","progress","comment","mal_post_data","setPostData","useSelector","state","find","classes","useStyles","dispatch","useDispatch","useEffect","clear","Paper","className","onSubmit","evt","preventDefault","api","Typography","variant","TextField","name","label","fullWidth","value","onChange","target","inputProps","maxLength","multiple","onDone","image_data","Button","submit_btn","color","size","text","post_image","Post","onClick","src","alt","Posts","length","posts_container","sort_button","PostContainer","setOrder","current_posts","sortPostsFrontend","sortPosts","Container","startIcon","App","store","createStore","reducers","compose","applyMiddleware","thunk","ReactDOM","render","document","getElementById"],"mappings":"oMAAaA,EAAY,YACZC,EAAO,OACPC,EAAS,SACTC,EAAS,SACTC,EAAO,OCmDLC,EArDM,WACpB,IADqBC,EACtB,uDAD8B,GAAIC,EAClC,uCACE,OAAQA,EAAOC,MAEb,KAAKR,EAIH,OAAOO,EAAOE,QAChB,KAAKR,EAIH,MAAM,GAAN,mBAAWK,GAAX,CAAkBC,EAAOE,UAC3B,KAAKP,EAOH,OAAOI,EAAMI,KAAI,SAACC,GAAD,OAAUA,EAAKC,MAAQL,EAAOE,QAAQG,IAAML,EAAOE,QAAUE,KAChF,KAAKR,EAIH,OAAOG,EAAMO,QAAO,SAACF,GAAD,OAAUA,EAAKC,MAAQL,EAAOE,WACpD,KAAK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,EAAD,CAAMwB,UAAWA,EAAWC,aAAcA,IAC1C,cAAC,EAAD,CAAeA,aAAcA,UCd/B2D,G,OAAQC,YAAYC,EAAUC,YAAQC,YAAgBC,QAE5DC,IAASC,OACP,cAAC,IAAD,CAAUP,MAAOA,EAAjB,SACE,cAAC,EAAD,MAEFQ,SAASC,eAAe,W","file":"static/js/main.e324ee17.chunk.js","sourcesContent":["export const FETCH_ALL = \"FETCH_ALL\";\r\nexport const POST = \"POST\";\r\nexport const UPDATE = \"UPDATE\";\r\nexport const DELETE = \"DELETE\";\r\nexport const SORT = \"SORT\";","import { FETCH_ALL, POST, UPDATE, DELETE, SORT } from \"./../constants/action_types\";\r\n\r\nconst post_handler = (posts = [], action) =>\r\n{\r\n switch (action.type)\r\n {\r\n case FETCH_ALL:\r\n /**\r\n * Return and store new array with all posts fetched from api\r\n */\r\n return action.payload;\r\n case POST:\r\n /**\r\n * Return and store new array with all posts and the new post\r\n */\r\n return [...posts, action.payload];\r\n case UPDATE:\r\n /**\r\n * To explain what the fuck is going on here\r\n * This checks every post and checks if it was the one that was updated\r\n * If it was updated it will return the payload, the return data from the api\r\n * If it wasn't updated it will simply return the post as it was\r\n */\r\n return posts.map((post) => post._id === action.payload._id ? action.payload : post);\r\n case DELETE:\r\n /**\r\n * Return and store new array with all posts that don't match the deleted post\r\n */\r\n return posts.filter((post) => post._id !== action.payload);\r\n case SORT:\r\n /**\r\n * Return and store new array with all posts sorted by rating\r\n * Sorted in descending or ascending order based on order type of action\r\n */\r\n\r\n const hold = [...action.payload.data];\r\n let sorted_posts;\r\n\r\n switch (action.payload.descending)\r\n {\r\n case true:\r\n sorted_posts = hold.sort((a, b) => b.rating - a.rating);\r\n break;\r\n case false:\r\n sorted_posts = hold.sort((a, b) => a.rating - b.rating);\r\n break;\r\n default:\r\n console.log(\"How there would be a third option idk but the compiler keeps yelling at me\");\r\n }\r\n return sorted_posts;\r\n default:\r\n return posts;\r\n }\r\n}\r\n\r\nexport default post_handler;\r\n","import { combineReducers } from \"redux\";\r\nimport posts from \"./posts\"\r\n\r\n/**\r\n * This actually says\r\n * export default combineReducers({\r\n * posts : posts,\r\n * });\r\n */\r\nexport default combineReducers({ posts });","import { makeStyles } from \"@material-ui/core/styles\"\r\n\r\n//padding order: top right bottom left\r\n\r\nexport default makeStyles((theme) => ({\r\n mainContainer: {\r\n margin: \"0px\",\r\n padding: \"5px 0 0 5px\",\r\n },\r\n subContainer: {\r\n margin: \"0px\",\r\n padding: \"0px\"\r\n }\r\n}))\r\n","import axios from \"axios\";\r\n\r\nconst url = \"https://scuffedwebsite.com/mal/api/posts\";\r\nexport const fetchPosts = async () => await axios.get(url);\r\nexport const createPost = async (post_data) => await axios.post(url, post_data);\r\nexport const updatePost = async (id, post_data) => await axios.patch(`${url}/${id}`, post_data);\r\nexport const deletePost = async (id) => await axios.delete(`${url}/${id}`);","import { makeStyles } from \"@material-ui/core/styles\"\r\n\r\nexport default makeStyles((theme) => ({\r\n paper: {\r\n padding: theme.spacing(2),\r\n marginBottom: \"10px\",\r\n },\r\n root_form: {\r\n display: \"grid\",\r\n },\r\n text_field: {\r\n width: \"100%\",\r\n marginBottom: \"2px\"\r\n },\r\n select: {\r\n height: \"23px\",\r\n marginBottom: \"2px\"\r\n },\r\n file_input_wrapper: {\r\n \"marginBottom\": \"2px\"\r\n },\r\n file_input: {\r\n }\r\n}));\r\n","import React, { useState, useEffect } from \"react\";\r\nimport { TextField, Button, Typography, Paper } from \"@material-ui/core\";\r\nimport FileBase from \"react-file-base64\";\r\nimport { useDispatch, useSelector } from \"react-redux\";\r\nimport { createPost, updatePost } from \"./../../actions/posts\";\r\n\r\nimport useStyles from \"./styles\";\r\n\r\nconst Form = ({ currentId, setCurrentId }) =>\r\n{\r\n\r\n //Setting progress to finished by default as it's going to be the most common by far\r\n const [mal_post_data, setPostData] = useState({ title: \"\", rating: \"\", image: \"\", progress: \"Finished\", comment: \"\" });\r\n const post = useSelector((state) => currentId ? state.posts.find((post) => post._id === currentId) : null);\r\n\r\n const classes = useStyles();\r\n const dispatch = useDispatch();\r\n\r\n\r\n useEffect(() =>\r\n {\r\n if (post) setPostData(post);\r\n }, [post])\r\n\r\n\r\n const HandleSubmit = (evt) =>\r\n {\r\n evt.preventDefault();\r\n if (currentId)\r\n {\r\n dispatch(updatePost(currentId, mal_post_data));\r\n }\r\n else\r\n {\r\n dispatch(createPost(mal_post_data));\r\n }\r\n\r\n clear();\r\n }\r\n\r\n const clear = () =>\r\n {\r\n setCurrentId(null);\r\n setPostData({ title: \"\", rating: \"\", image: \"\", progress: \"Finished\", comment: \"\" });\r\n }\r\n\r\n return (\r\n
\r\n \r\n
\r\n {!currentId ? (Post) : (Update)}\r\n setPostData({ ...mal_post_data, title: evt.target.value })} />\r\n setPostData({ ...mal_post_data, rating: evt.target.value })} />\r\n setPostData({ ...mal_post_data, comment: evt.target.value })} />\r\n \r\n
\r\n setPostData({ ...mal_post_data, image: image_data })} />\r\n
\r\n \r\n \r\n
\r\n
\r\n );\r\n}\r\n\r\n\r\nexport default Form;\r\n\r\n","import * as api from \"./../api/index\";\r\nimport { FETCH_ALL, POST, DELETE, UPDATE, SORT } from \"./../constants/action_types\";\r\n\r\nexport const getPosts = () => async (dispatch) => \r\n{\r\n try\r\n {\r\n const { data } = await api.fetchPosts();\r\n dispatch({ type: FETCH_ALL, payload: data });\r\n }\r\n catch (err)\r\n {\r\n console.log(err);\r\n }\r\n}\r\n\r\nexport const createPost = (post) => async (dispatch) =>\r\n{\r\n try\r\n {\r\n const { data } = await api.createPost(post);\r\n dispatch({ type: POST, payload: data });\r\n }\r\n catch (err)\r\n {\r\n console.log(err);\r\n }\r\n}\r\n\r\nexport const updatePost = (id, post) => async (dispatch) =>\r\n{\r\n try\r\n {\r\n const { data } = await api.updatePost(id, post);\r\n dispatch({ type: UPDATE, payload: data });\r\n }\r\n catch (err)\r\n {\r\n console.log(err);\r\n }\r\n}\r\n\r\nexport const deletePost = (id) => async (dispatch) =>\r\n{\r\n try\r\n {\r\n //duh delete doesn't fucking return anything that's why it wasn't working\r\n await api.deletePost(id);\r\n dispatch({ type: DELETE, payload: id });\r\n }\r\n catch (err)\r\n {\r\n console.log(err);\r\n }\r\n}\r\n\r\nexport const sortPosts = (posts, descending) => async (dispatch) =>\r\n{\r\n dispatch({ type: SORT, payload: { data: posts, descending: descending } });\r\n}","import { makeStyles } from \"@material-ui/core/styles\";\r\n\r\nexport default makeStyles(() => ({\r\n mainContainer: {\r\n display: \"inline-block\"\r\n }\r\n}))","import { makeStyles } from \"@material-ui/core/styles\";\r\n\r\nexport default makeStyles(() => ({\r\n post: {\r\n display: \"block\",\r\n width: \"100%\",\r\n \"overflowWrap\":\"break-word\"\r\n },\r\n text: {\r\n \"display\": \"inline-block\"\r\n },\r\n post_image: {\r\n width: \"100%\"\r\n }\r\n}))","import { Paper, Typography, Button, Grid } from \"@material-ui/core\"\r\nimport { useDispatch } from \"react-redux\";\r\nimport useStyles from \"./styles\"\r\n\r\nimport { deletePost } from \"./../../../../actions/posts\";\r\n\r\nconst Post = ({ post, setCurrentId }) =>\r\n{\r\n\r\n const classes = useStyles();\r\n const dispatch = useDispatch();\r\n\r\n return (\r\n \r\n Title: {post.title}
\r\n {post.progress}
\r\n Score: {post.rating}
\r\n Comments: {post.comment}
\r\n \r\n
\r\n \"fuck\"\r\n
\r\n );\r\n}\r\n\r\nexport default Post;","import React from 'react';\r\nimport { Grid } from \"@material-ui/core\";\r\nimport { useSelector } from \"react-redux\";\r\nimport useStyles from \"./styles\"\r\nimport Post from \"./post/post\";\r\n\r\nconst Posts = ({ setCurrentId }) =>\r\n{\r\n\r\n const posts = useSelector((state) => state.posts);\r\n const classes = useStyles();\r\n\r\n /**\r\n * If no posts display loading\r\n * If posts loop through each and create an individual post element\r\n */\r\n\r\n return (\r\n !posts.length ?

Loading...

: (\r\n
\r\n {posts.map((post) =>\r\n (\r\n \r\n ))}\r\n
\r\n )\r\n );\r\n}\r\n\r\nexport default Posts;","import { makeStyles } from \"@material-ui/core/styles\";\r\n\r\nexport default makeStyles(() => ({\r\n posts_container: {\r\n \"padding\": \"0 0 0 0\",\r\n \"display\": \"block\",\r\n \"width\": \"100%\"\r\n },\r\n sort_button: {\r\n \"width\": \"25%\",\r\n \"marginBottom\": \"10px\",\r\n \"backgroundColor\": \"#fff\"\r\n }\r\n}))","import React, { useState } from \"react\";\r\nimport { Container, Button } from \"@material-ui/core\";\r\nimport { useSelector, useDispatch } from \"react-redux\";\r\n\r\n//import * as sortPostsFrontendIcon from \"@material-ui/icons/sortPostsFrontend\"\r\nimport Sort from \"@material-ui/icons/Sort\"\r\nimport Posts from \"./posts/posts\";\r\nimport useStyles from \"./styles\";\r\n\r\nimport { sortPosts } from \"./../../actions/posts\";\r\n\r\nconst PostContainer = ({ setCurrentId }) =>\r\n{\r\n //Switches between descending and ascending post order based on rating\r\n const [descending, setOrder] = useState(true);\r\n\r\n const classes = useStyles();\r\n const current_posts = useSelector((state) => state.posts);\r\n\r\n const dispatch = useDispatch();\r\n\r\n const sortPostsFrontend = (posts) =>\r\n {\r\n dispatch(sortPosts(posts, descending));\r\n setOrder(!descending);\r\n }\r\n\r\n return (\r\n \r\n