Skip to content

Commit

Permalink
Fjenet unødvendig kode, som ikke burkes mer
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasSJacobsen committed Oct 12, 2020
1 parent 802807d commit 3c3e3e6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
3 changes: 0 additions & 3 deletions src/BackOffice/AddPost.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const AddPost = ({
const oldInformation = post;

const [id] = useState(post.id);
const [timeOnEveryPost] = useState(post.timeOnEveryPost);
const [title, setTitle] = useState(post.title);
const [startGroup, setGroup] = useState(post.startGroup);
const [address, setAddress] = useState(post.address);
Expand All @@ -43,15 +42,13 @@ const AddPost = ({
startGroup: startGroup,
address: address,
googleMaps: googleMaps,
timeOnEveryPost: timeOnEveryPost,
}),
[
id,
title,
startGroup,
address,
googleMaps,
timeOnEveryPost,
setCurrentPost,
],
);
Expand Down
6 changes: 5 additions & 1 deletion src/BackOffice/CreateNewEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const CreateNewEvent = ({

/** Her er syntaxen til subeventene */
const [posts, setPosts] = useState([]);
const [postTime, setPostTime] = useState(0);

/** *************************************************************************** */

Expand Down Expand Up @@ -142,7 +143,8 @@ const CreateNewEvent = ({
from_EN: isMentorBoard ? "the mentor board" : "group leader",
start_time: `${startTimeHour}:${startTimeMinute}`,
groups: groups.sort(groupComparator),
posts: posts
posts: posts,
post_time: postTime,
};

if (address.length >= 3) {
Expand Down Expand Up @@ -336,6 +338,8 @@ const CreateNewEvent = ({
setPosts={setPosts}
errors={errors}
setErrors={setErrors}
postTime={postTime}
setPostTime={setPostTime}
/>
)}

Expand Down
12 changes: 3 additions & 9 deletions src/BackOffice/EventWithPosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import AddEventButton from "./AddEventButton";
import uuid from "react-uuid";
import { Form, Input } from "semantic-ui-react";

const EventWithPosts = ({ selectedGroups, posts, setPosts }) => {
const EventWithPosts = ({ selectedGroups, posts, setPosts, setPostTime, postTime }) => {
const [currentPost, setCurrentPost] = useState([]);
const [timeOnEveryPost, setTimeOnEveryPost] = useState(""); // need to change that i it only can be numbers,
// isteden for at den blir med inni til addpost kan tiden bli lagt på objektene når alle er lagt til altså på sumit

const [int, setInt] = useState(1); // skal egentlig være 0 men siden vi har en i "databasen fra før av tar vi 1"

Expand Down Expand Up @@ -39,12 +37,9 @@ const EventWithPosts = ({ selectedGroups, posts, setPosts }) => {
<Input
className="time-input"
placeholder="00"
value={timeOnEveryPost}
value={postTime }
onChange={(_, data) => {
setTimeOnEveryPost(data.value);
posts.forEach(element => {
element.timeOnEveryPost = data.value;
});
setPostTime(data.value);
}}
type="number"
autoComplete="off"
Expand Down Expand Up @@ -74,7 +69,6 @@ const EventWithPosts = ({ selectedGroups, posts, setPosts }) => {
startGroup: "",
address: "",
googleMaps: "",
timeOnEveryPost: timeOnEveryPost,
}}
deleteCallback={deletePost}
/>
Expand Down

0 comments on commit 3c3e3e6

Please sign in to comment.