diff --git a/staff/nerina-castillo/ponies/app/logic/getAllFavPosts.mjs b/staff/nerina-castillo/ponies/app/logic/getAllFavPosts.mjs
index 276a9fc7a..78aef5d5b 100644
--- a/staff/nerina-castillo/ponies/app/logic/getAllFavPosts.mjs
+++ b/staff/nerina-castillo/ponies/app/logic/getAllFavPosts.mjs
@@ -12,7 +12,10 @@ const getAllFavPosts = () => {
posts.forEach((post) => {
post.fav = user.favs.includes(post.id);
post.like = post.likes.includes(sessionStorage.username);
- post.following = user.following.includes(post.author);
+ post.author = {
+ username: post.author,
+ following: user.following.includes(post.author)
+ }
});
return posts.reverse();
diff --git a/staff/nerina-castillo/ponies/app/logic/getAllFollowingUsersPosts.mjs b/staff/nerina-castillo/ponies/app/logic/getAllFollowingUserPosts.mjs
similarity index 67%
rename from staff/nerina-castillo/ponies/app/logic/getAllFollowingUsersPosts.mjs
rename to staff/nerina-castillo/ponies/app/logic/getAllFollowingUserPosts.mjs
index 8b1299f94..2240128a4 100644
--- a/staff/nerina-castillo/ponies/app/logic/getAllFollowingUsersPosts.mjs
+++ b/staff/nerina-castillo/ponies/app/logic/getAllFollowingUserPosts.mjs
@@ -1,6 +1,6 @@
import data from "../data/index.mjs";
-const getAllFollowingUsersPosts = () => {
+const getAllFollowingUserPosts = () => {
const user = data.findUser(
(user) => user.username === sessionStorage.username
);
@@ -12,10 +12,13 @@ const getAllFollowingUsersPosts = () => {
posts.forEach((post) => {
post.fav = user.favs.includes(post.id);
post.like = post.likes.includes(sessionStorage.username);
- post.following = user.following.includes(post.author);
+ post.author = {
+ username: post.author,
+ following: user.following.includes(post.author)
+ }
});
return posts.reverse();
};
-export default getAllFollowingUsersPosts;
+export default getAllFollowingUserPosts;
diff --git a/staff/nerina-castillo/ponies/app/logic/getAllPosts.mjs b/staff/nerina-castillo/ponies/app/logic/getAllPosts.mjs
index 32fb139af..294bac17c 100644
--- a/staff/nerina-castillo/ponies/app/logic/getAllPosts.mjs
+++ b/staff/nerina-castillo/ponies/app/logic/getAllPosts.mjs
@@ -12,7 +12,10 @@ const getAllPosts = () => {
posts.forEach((post) => {
post.fav = user.favs.includes(post.id);
post.like = post.likes.includes(sessionStorage.username);
- post.following = user.following.includes(post.author);
+ post.author = {
+ username: post.author,
+ following: user.following.includes(post.author)
+ }
});
return posts.reverse();
diff --git a/staff/nerina-castillo/ponies/app/logic/index.mjs b/staff/nerina-castillo/ponies/app/logic/index.mjs
index cead28c39..59fa4005d 100644
--- a/staff/nerina-castillo/ponies/app/logic/index.mjs
+++ b/staff/nerina-castillo/ponies/app/logic/index.mjs
@@ -11,7 +11,7 @@ import deletePost from "./deletePost.mjs";
import toggleFavPost from "./toggleFavPost.mjs";
import getAllFavPosts from "./getAllFavPosts.mjs";
import toggleFollowUser from "./toggleFollowUser.mjs";
-import getAllFollowingUsersPosts from "./getAllFollowingUsersPosts.mjs";
+import getAllFollowingUserPosts from "./getAllFollowingUserPosts.mjs";
const logic = {
getAllPosts,
@@ -27,7 +27,7 @@ const logic = {
toggleFavPost,
getAllFavPosts,
toggleFollowUser,
- getAllFollowingUsersPosts,
+ getAllFollowingUserPosts,
};
export default logic;
diff --git a/staff/nerina-castillo/ponies/app/view/Component.mjs b/staff/nerina-castillo/ponies/app/view/Component.mjs
deleted file mode 100644
index ed5ac946c..000000000
--- a/staff/nerina-castillo/ponies/app/view/Component.mjs
+++ /dev/null
@@ -1,111 +0,0 @@
-class Component {
- constructor(container) {
- this.container = container;
- }
-
- add(child) {
- if (!(child instanceof Component))
- throw new TypeError("child is not a Component");
-
- this.container.appendChild(child.container);
- }
-
- remove(child) {
- if (!(child instanceof Component))
- throw new TypeError("child is not a Component");
-
- this.container.removeChild(child.container);
- }
-
- has(child) {
- if (!(child instanceof Component))
- throw new TypeError("child is not a Component");
-
- const children = this.container.children;
-
- for (let i = 0; i < children.length; i++) {
- const childContainer = children[i];
-
- if (childContainer === child.container) return true;
- }
-
- return false;
- }
-
- setText(text) {
- if (typeof text !== "string") throw new TypeError("text is not a string");
-
- this.container.innerText = text;
- }
-
- setBackgroundColor(color) {
- if (typeof color !== "string") throw new TypeError("color is not a string");
-
- this.container.style.backgroundColor = color;
- }
-
- setColor(color) {
- if (typeof color !== "string") throw new TypeError("color is not a string");
-
- this.container.style.color = color;
- }
-
- setClassName(className) {
- if (typeof className !== "string")
- throw new TypeError("className is not a string");
-
- this.container.className = className;
- }
-
- addClassName(className) {
- if (typeof className !== "string")
- throw new TypeError("className is not a string");
-
- this.container.classList.add(className);
- }
-
- removeClassName(className) {
- if (typeof className !== "string")
- throw new TypeError("className is not a string");
-
- this.container.classList.remove(className);
- }
-
- toggleClassName(className) {
- if (typeof className !== "string")
- throw new TypeError("className is not a string");
-
- this.container.classList.toggle(className);
- }
-
- setHtmlFor(htmlFor) {
- if (typeof htmlFor !== "string")
- throw new TypeError("htmlFor is not a string");
-
- this.container.htmlFor = htmlFor;
- }
-
- setType(type) {
- if (typeof type !== "string") throw new TypeError("type is not a function");
-
- this.container.type = type;
- }
-
- setId(id) {
- if (typeof id !== "string") throw new TypeError("id is not a string");
-
- this.container.id = id;
- }
-
- setValue(value) {
- if (typeof value !== "string") throw new TypeError("value is not a string");
-
- this.container.value = value;
- }
-
- getValue() {
- return this.container.value;
- }
-}
-
-export default Component;
diff --git a/staff/nerina-castillo/ponies/app/view/components/Button.mjs b/staff/nerina-castillo/ponies/app/view/components/Button.mjs
deleted file mode 100644
index 8882c930f..000000000
--- a/staff/nerina-castillo/ponies/app/view/components/Button.mjs
+++ /dev/null
@@ -1,14 +0,0 @@
-import Component from "../Component.mjs";
-
-class Button extends Component {
- constructor() {
- super(document.createElement("button"));
- this.setClassName("Button");
- }
-
- onClick(callback) {
- this.container.onclick = callback;
- }
-}
-
-export default Button;
diff --git a/staff/nerina-castillo/ponies/app/view/components/Form.mjs b/staff/nerina-castillo/ponies/app/view/components/Form.mjs
deleted file mode 100644
index 6ab1378c6..000000000
--- a/staff/nerina-castillo/ponies/app/view/components/Form.mjs
+++ /dev/null
@@ -1,17 +0,0 @@
-import Component from "../Component.mjs";
-
-class Form extends Component {
- constructor(selector) {
- super(
- selector
- ? document.querySelector(selector)
- : document.createElement("form")
- );
- }
-
- onSubmit(callback) {
- this.container.onsubmit = callback;
- }
-}
-
-export default Form;
diff --git a/staff/nerina-castillo/ponies/app/view/components/Heading.mjs b/staff/nerina-castillo/ponies/app/view/components/Heading.mjs
deleted file mode 100644
index ad593738b..000000000
--- a/staff/nerina-castillo/ponies/app/view/components/Heading.mjs
+++ /dev/null
@@ -1,9 +0,0 @@
-import Component from "../Component.mjs";
-
-class Heading extends Component {
- constructor(level) {
- super(document.createElement(`h${level}`));
- }
-}
-
-export default Heading;
diff --git a/staff/nerina-castillo/ponies/app/view/components/Image.mjs b/staff/nerina-castillo/ponies/app/view/components/Image.mjs
deleted file mode 100644
index e07eeb669..000000000
--- a/staff/nerina-castillo/ponies/app/view/components/Image.mjs
+++ /dev/null
@@ -1,15 +0,0 @@
-import Component from "../Component.mjs";
-
-class Image extends Component {
- constructor() {
- super(document.createElement("img"));
- }
-
- setSrc(src) {
- if (typeof src !== "string") throw new TypeError("src is not a string");
-
- this.container.src = src;
- }
-}
-
-export default Image;
diff --git a/staff/nerina-castillo/ponies/app/view/components/Input.mjs b/staff/nerina-castillo/ponies/app/view/components/Input.mjs
deleted file mode 100644
index f7f95c9c0..000000000
--- a/staff/nerina-castillo/ponies/app/view/components/Input.mjs
+++ /dev/null
@@ -1,11 +0,0 @@
-import Component from "../Component.mjs";
-
-class Input extends Component {
- constructor() {
- super(document.createElement("input"));
-
- this.container.name = "input";
- }
-}
-
-export default Input;
diff --git a/staff/nerina-castillo/ponies/app/view/components/Label.mjs b/staff/nerina-castillo/ponies/app/view/components/Label.mjs
deleted file mode 100644
index 4e44e9c6a..000000000
--- a/staff/nerina-castillo/ponies/app/view/components/Label.mjs
+++ /dev/null
@@ -1,11 +0,0 @@
-import Component from "../Component.mjs";
-
-class Label extends Component {
- constructor() {
- super(document.createElement("label"));
-
- this.container.className = "label";
- }
-}
-
-export default Label;
diff --git a/staff/nerina-castillo/ponies/app/view/components/Link.mjs b/staff/nerina-castillo/ponies/app/view/components/Link.mjs
deleted file mode 100644
index e2e4de8ff..000000000
--- a/staff/nerina-castillo/ponies/app/view/components/Link.mjs
+++ /dev/null
@@ -1,13 +0,0 @@
-import Component from "../Component.mjs";
-
-class Link extends Component {
- constructor(selector) {
- super(document.querySelector(selector));
- }
-
- onClick(callback) {
- this.container.onclick = callback;
- }
-}
-
-export default Link;
diff --git a/staff/nerina-castillo/ponies/app/view/components/Paragraph.mjs b/staff/nerina-castillo/ponies/app/view/components/Paragraph.mjs
deleted file mode 100644
index 1ac2293e0..000000000
--- a/staff/nerina-castillo/ponies/app/view/components/Paragraph.mjs
+++ /dev/null
@@ -1,9 +0,0 @@
-import Component from "../Component.mjs";
-
-class Paragraph extends Component {
- constructor() {
- super(document.createElement("p"));
- }
-}
-
-export default Paragraph;
diff --git a/staff/nerina-castillo/ponies/app/view/components/Button.css b/staff/nerina-castillo/ponies/app/view/home/components/Button.css
similarity index 74%
rename from staff/nerina-castillo/ponies/app/view/components/Button.css
rename to staff/nerina-castillo/ponies/app/view/home/components/Button.css
index 2822c2fda..04ea5cbe8 100644
--- a/staff/nerina-castillo/ponies/app/view/components/Button.css
+++ b/staff/nerina-castillo/ponies/app/view/home/components/Button.css
@@ -1,13 +1,13 @@
-.Button{
+.Button {
background: white;
- color:black;
+ color: black;
border-radius: 5px;
border: none;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
padding: .25rem .5rem;
-
+
}
-.Button--active{
+.Button--active {
background-color: rgb(231, 230, 237);
-}
+}
\ No newline at end of file
diff --git a/staff/nerina-castillo/ponies/app/view/home/components/FavPostList.mjs b/staff/nerina-castillo/ponies/app/view/home/components/FavPostList.mjs
deleted file mode 100644
index 133ca9f0f..000000000
--- a/staff/nerina-castillo/ponies/app/view/home/components/FavPostList.mjs
+++ /dev/null
@@ -1,65 +0,0 @@
-import Component from "../../Component.mjs";
-import Post from "./Post.mjs";
-
-import logic from "../../../logic/index.mjs";
-
-class FavPostList extends Component {
- constructor() {
- super(document.createElement("section"));
-
- this.setClassName("post-list");
- }
-
- clearPosts() {
- for (let i = this.container.children.length - 1; i > -1; i--) {
- const child = this.container.children[i];
-
- this.container.removeChild(child);
- }
- }
-
- listPosts() {
- try {
- const posts = logic.getAllFavPosts();
-
- const self = this;
-
- posts.forEach((_post) => {
- const post = new Post(_post);
-
- post.onPostDeleted(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onPostCaptionEdited(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onPostLikeToggled(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onPostFavToggled(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onFollowUserToggled(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- self.add(post);
- });
- } catch (error) {
- console.error(error);
-
- alert(error.message);
- }
- }
-}
-
-export default FavPostList;
diff --git a/staff/nerina-castillo/ponies/app/view/home/components/FollowingPostList.mjs b/staff/nerina-castillo/ponies/app/view/home/components/FollowingPostList.mjs
deleted file mode 100644
index 6a561ce4d..000000000
--- a/staff/nerina-castillo/ponies/app/view/home/components/FollowingPostList.mjs
+++ /dev/null
@@ -1,65 +0,0 @@
-import Component from "../../Component.mjs";
-import Post from "./Post.mjs";
-
-import logic from "../../../logic/index.mjs";
-
-class FollowingPostList extends Component {
- constructor() {
- super(document.createElement("section"));
-
- this.setClassName("post-list");
- }
-
- clearPosts() {
- for (let i = this.container.children.length - 1; i > -1; i--) {
- const child = this.container.children[i];
-
- this.container.removeChild(child);
- }
- }
-
- listPosts() {
- try {
- const posts = logic.getAllFollowingUsersPosts();
-
- const self = this;
-
- posts.forEach((_post) => {
- const post = new Post(_post);
-
- post.onPostDeleted(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onPostCaptionEdited(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onPostLikeToggled(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onPostFavToggled(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onFollowUserToggled(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- self.add(post);
- });
- } catch (error) {
- console.error(error);
-
- alert(error.message);
- }
- }
-}
-
-export default FollowingPostList;
diff --git a/staff/nerina-castillo/ponies/app/view/home/components/Footer.jsx b/staff/nerina-castillo/ponies/app/view/home/components/Footer.jsx
new file mode 100644
index 000000000..50f903c49
--- /dev/null
+++ b/staff/nerina-castillo/ponies/app/view/home/components/Footer.jsx
@@ -0,0 +1,64 @@
+import logic from "../../../logic/index.mjs";
+
+const { Component } = React
+
+class Footer extends Component {
+ constructor() {
+ super()
+
+ }
+
+ state = { showing: false }
+
+ handleCreatePostSubmit(event) {
+ event.preventDefault()
+
+ const form = event.target
+
+ const postImageInput = form['post-image-input']
+ const postCaptionInput = form['post-caption-input']
+
+ const postImage = postImageInput.value
+ const postCaption = postCaptionInput.value
+
+ try {
+ logic.createPost(postImage, postCaption);
+ this.setState({ showing: false });
+
+ this.onPostCreatedCallback();
+ } catch (error) {
+ console.error(error);
+ alert(error.message);
+ }
+ }
+
+ handlePostCreated(callback) {
+ this.handlePostCreatedCallback = callback
+ }
+
+ render() {
+ const { showing } = this.state
+ return
+ }
+}
+
+export default Footer
\ No newline at end of file
diff --git a/staff/nerina-castillo/ponies/app/view/home/components/Footer.mjs b/staff/nerina-castillo/ponies/app/view/home/components/Footer.mjs
deleted file mode 100644
index 6e2400266..000000000
--- a/staff/nerina-castillo/ponies/app/view/home/components/Footer.mjs
+++ /dev/null
@@ -1,109 +0,0 @@
-import Component from "../../Component.mjs";
-import Button from "../../components/Button.mjs";
-import Heading from "../../components/Heading.mjs";
-import Label from "../../components/Label.mjs";
-import Form from "../../components/Form.mjs";
-import Input from "../../components/Input.mjs";
-
-import logic from "../../../logic/index.mjs";
-
-class Footer extends Component {
- constructor() {
- super(document.createElement("footer"));
- this.setClassName("footer");
-
- const addPostButton = new Button();
- addPostButton.setClassName("add-post-button");
- addPostButton.setText("+");
- this.add(addPostButton);
-
- const self = this;
-
- addPostButton.onClick(() => {
- const createPost = new Component(document.createElement("section"));
- createPost.setClassName("create-post-section");
- self.add(createPost);
-
- const createPostTitle = new Heading(2);
- createPostTitle.setClassName("create-post-section__title");
- createPostTitle.setText("Create Post");
- createPost.add(createPostTitle);
-
- const createPostForm = new Form();
- createPostForm.setClassName("form");
- createPost.add(createPostForm);
-
- createPostForm.onSubmit((event) => {
- event.preventDefault();
- const postImageInput = document.getElementById("post-image-input");
- const postCaptionInput = document.getElementById("post-caption-input");
-
- const postImage = postImageInput.value;
- const postCaption = postCaptionInput.value;
-
- try {
- logic.createPost(postImage, postCaption);
-
- self.remove(createPost);
-
- self.onPostCreatedCallback();
- } catch (error) {
- console.error(error);
-
- alert(error.message);
- }
- });
- const postImageFieldDiv = new Component(document.createElement("div"));
- postImageFieldDiv.setClassName("form__field");
- createPostForm.add(postImageFieldDiv);
-
- const postImageLabel = new Label();
- postImageLabel.setHtmlFor("post-image-input");
- postImageLabel.setText("Image");
- createPostForm.add(postImageLabel);
-
- const postImageInput = new Input();
- postImageInput.setClassName("form__input");
- postImageInput.setId("post-image-input");
- createPostForm.add(postImageInput);
-
- const postCaptionFieldDiv = new Component(document.createElement("div"));
- postCaptionFieldDiv.setClassName("form__field");
- createPostForm.add(postCaptionFieldDiv);
-
- const postCaptionLabel = new Label();
- postCaptionLabel.setHtmlFor("post-caption-input");
- postCaptionLabel.setText("Caption");
- createPostForm.add(postCaptionLabel);
-
- const postCaptionInput = new Input();
- postCaptionInput.setClassName("form__caption-input");
- postCaptionInput.setId("post-caption-input");
- createPostForm.add(postCaptionInput);
-
- const postButtonsDiv = new Component(document.createElement("div"));
- postButtonsDiv.setClassName("create-post-section__buttons");
- createPostForm.add(postButtonsDiv);
-
- const postSubmitButton = new Button();
- postSubmitButton.setClassName("form__button");
- postSubmitButton.setType("submit");
- postSubmitButton.setText("Create");
- createPostForm.add(postSubmitButton);
-
- const postCancelButton = new Button();
- postCancelButton.setClassName("form__button");
- postCancelButton.setType("reset");
- postCancelButton.setText("Cancel");
- createPostForm.add(postCancelButton);
-
- postCancelButton.onClick(() => self.remove(createPost));
- });
- }
-
- onPostCreated(callback) {
- this.onPostCreatedCallback = callback;
- }
-}
-
-export default Footer;
diff --git a/staff/nerina-castillo/ponies/app/view/home/components/Header.jsx b/staff/nerina-castillo/ponies/app/view/home/components/Header.jsx
new file mode 100644
index 000000000..f968cc7e8
--- /dev/null
+++ b/staff/nerina-castillo/ponies/app/view/home/components/Header.jsx
@@ -0,0 +1,43 @@
+import logic from '../../../logic/index.mjs'
+
+const { Component } = React
+
+class Header extends Component {
+ constructor() {
+ super()
+
+ try {
+ const name = logic.getUserName()
+
+ this.state = { name }
+ } catch (error) {
+ console.error(error)
+
+ alert(error.message)
+ }
+ }
+
+ handleLogout() {
+ try {
+ logic.logoutUser()
+
+ location.href = '../login'
+ } catch (error) {
+ console.error(error)
+
+ alert(error.message)
+ }
+ }
+
+ render() {
+ return
+ }
+}
+
+export default Header
\ No newline at end of file
diff --git a/staff/nerina-castillo/ponies/app/view/home/components/Header.mjs b/staff/nerina-castillo/ponies/app/view/home/components/Header.mjs
deleted file mode 100644
index ab60be142..000000000
--- a/staff/nerina-castillo/ponies/app/view/home/components/Header.mjs
+++ /dev/null
@@ -1,105 +0,0 @@
-import Component from "../../Component.mjs";
-import Paragraph from "../../components/Paragraph.mjs";
-import Button from "../../components/Button.mjs";
-// import Heading from "../../components/Heading.mjs";
-
-import logic from "../../../logic/index.mjs";
-
-class Header extends Component {
- constructor() {
- super(document.createElement("header"));
- this.setClassName("header");
-
- // const logo = new Heading(1);
- // logo.setClassName("logo");
- // logo.setText("Ponies");
- // this.add(logo);
-
- const userName = new Paragraph();
- userName.setClassName("header__user-name");
- this.add(userName);
-
- try {
- const name = logic.getUserName();
-
- userName.setText("Hello, " + name + "!");
- } catch (error) {
- console.error(error);
-
- alert(error.message);
- }
-
- const self = this;
-
- const homeButton = new Button();
- homeButton.setText("🏚️");
- homeButton.addClassName("Button--active");
- this.add(homeButton);
-
- homeButton.onClick(() => {
- homeButton.addClassName("Button--active");
-
- followsButton.removeClassName("Button--active");
- favsButton.removeClassName("Button--active");
-
- self.onHomeClickCallback();
- });
-
- const followsButton = new Button();
- followsButton.setText("Following");
- this.add(followsButton);
-
- followsButton.onClick(() => {
- followsButton.addClassName("Button--active");
-
- homeButton.removeClassName("Button--active");
- favsButton.removeClassName("Button--active");
-
- self.onFollowsClickCallback();
- });
-
- const favsButton = new Button();
- favsButton.setText("💫");
- this.add(favsButton);
-
- favsButton.onClick(() => {
- favsButton.addClassName("Button--active");
-
- homeButton.removeClassName("Button--active");
- followsButton.removeClassName("Button--active");
-
- self.onFavsClickCallback();
- });
-
- const logoutButton = new Button();
- logoutButton.setClassName("logout-button");
- logoutButton.setText("Logout");
- this.add(logoutButton);
-
- logoutButton.onClick(() => {
- try {
- logic.logoutUser();
-
- location.href = "../login";
- } catch (error) {
- console.error(error);
-
- alert(error.message);
- }
- });
- }
-
- onHomeClick(callback) {
- this.onHomeClickCallback = callback;
- }
-
- onFavsClick(callback) {
- this.onFavsClickCallback = callback;
- }
-
- onFollowsClick(callback) {
- this.onFollowsClickCallback = callback;
- }
-}
-
-export default Header;
diff --git a/staff/nerina-castillo/ponies/app/view/home/components/Post.jsx b/staff/nerina-castillo/ponies/app/view/home/components/Post.jsx
new file mode 100644
index 000000000..5c120499c
--- /dev/null
+++ b/staff/nerina-castillo/ponies/app/view/home/components/Post.jsx
@@ -0,0 +1,41 @@
+import logic from '../../../logic/index.mjs'
+
+import formatTime from '../../../util/formatTime.mjs'
+
+const { Component } = React
+
+class Post extends Component {
+ constructor() {
+ super()
+ }
+
+ render() {
+ const post = this.props.post
+
+ return
+
+
{post.author.username}
+
+
+
+
+
+
+ {post.caption}
+
+
+
+
+
+ {post.author.username === logic.getUserUsername() && <>
+
+
+ >}
+
+
+
+
+ }
+}
+
+export default Post
\ No newline at end of file
diff --git a/staff/nerina-castillo/ponies/app/view/home/components/Post.mjs b/staff/nerina-castillo/ponies/app/view/home/components/Post.mjs
deleted file mode 100644
index 03ea2c3ea..000000000
--- a/staff/nerina-castillo/ponies/app/view/home/components/Post.mjs
+++ /dev/null
@@ -1,213 +0,0 @@
-import Component from "../../Component.mjs";
-import Heading from "../../components/Heading.mjs";
-import Image from "../../components/Image.mjs";
-import Paragraph from "../../components/Paragraph.mjs";
-import Button from "../../components/Button.mjs";
-import Form from "../../components/Form.mjs";
-import Label from "../../components/Label.mjs";
-import Input from "../../components/Input.mjs";
-
-import logic from "../../../logic/index.mjs";
-
-import formatTime from "../../../util/formatTime.mjs";
-
-class Post extends Component {
- constructor(post) {
- super(document.createElement("article"));
- this.setClassName("post");
-
- const self = this;
-
- const top = new Component(document.createElement("div"));
- top.setClassName("post__top");
- this.add(top);
-
- const postAuthorTitle = new Heading(3);
- postAuthorTitle.setClassName("post__author");
- postAuthorTitle.setText(post.author);
- top.add(postAuthorTitle);
-
- if (post.author !== logic.getUserUsername()) {
- const followButton = new Button();
- followButton.setText(post.following ? "Unfollow" : "Follow");
- top.add(followButton);
-
- followButton.onClick(() => {
- try {
- logic.toggleFollowUser(post.author);
-
- self.onFollowUserToggledCallback();
- } catch (error) {
- console.error(error);
-
- alert(error.message);
- }
- });
- }
-
- const postImage = new Image();
- postImage.setClassName("post__image");
- postImage.setSrc(post.image);
- this.add(postImage);
-
- const postCaptionText = new Paragraph();
- postCaptionText.setClassName("post__caption");
- postCaptionText.setText(post.caption);
- this.add(postCaptionText);
-
- const postActionButtons = new Component(document.createElement("div"));
- postActionButtons.setClassName("post__actions");
- this.add(postActionButtons);
-
- const postToggleLikeButton = new Button();
- postToggleLikeButton.setText(
- (post.like ? "❤️" : "🤍") +
- " " +
- post.likes.length +
- " like" +
- (post.likes.length === 1 ? "" : "s")
- );
- postActionButtons.add(postToggleLikeButton);
-
- postToggleLikeButton.onClick(() => {
- try {
- logic.toggleLikePost(post.id);
-
- self.onPostLikeToggledCallback();
- } catch (error) {
- console.error(error);
-
- alert(error.message);
- }
- });
-
- const postToggleFavButton = new Button();
- postToggleFavButton.setText(post.fav ? "💫" : "⭐");
- postActionButtons.add(postToggleFavButton);
-
- postToggleFavButton.onClick(() => {
- try {
- logic.toggleFavPost(post.id);
-
- self.onPostFavToggledCallback();
- } catch (error) {
- console.error(error);
-
- alert(error.message);
- }
- });
-
- if (post.author === logic.getUserUsername()) {
- const postDeleteButton = new Button();
- postDeleteButton.setText("Delete");
- postActionButtons.add(postDeleteButton);
-
- postDeleteButton.onClick(() => {
- if (confirm("Delete post?"))
- try {
- logic.deletePost(post.id);
-
- self.onPostDeletedCallback();
- } catch (error) {
- console.error(error);
-
- alert(error.message);
-
- if (error.message === "post not found") {
- self.onPostDeletedCallback();
- }
- }
- });
-
- const editButton = new Button();
- editButton.setText("Edit");
- postActionButtons.add(editButton);
-
- let editCaptionForm;
-
- editButton.onClick(() => {
- if (editCaptionForm) return;
-
- editCaptionForm = new Form();
- editCaptionForm.setClassName("form");
- self.add(editCaptionForm);
-
- const editCaptionLabel = new Label();
- editCaptionLabel.setHtmlFor("edit-caption-input");
- editCaptionForm.add(editCaptionLabel);
-
- const editCaptionInput = new Input();
- editCaptionInput.setId("edit-caption-input");
- editCaptionInput.setValue(post.caption);
- editCaptionInput.setClassName("form__caption-input");
- editCaptionForm.add(editCaptionInput);
-
- const editCaptionSubmitButton = new Button();
- editCaptionSubmitButton.setType("submit");
- editCaptionSubmitButton.setText("Save");
- editCaptionForm.add(editCaptionSubmitButton);
-
- const editCaptionCancelButton = new Button();
- editCaptionCancelButton.setText("Cancel");
- editCaptionCancelButton.setType("button");
- editCaptionForm.add(editCaptionCancelButton);
-
- editCaptionCancelButton.onClick(() => {
- self.remove(editCaptionForm);
-
- editCaptionForm = undefined;
- });
-
- editCaptionForm.onSubmit((event) => {
- event.preventDefault();
-
- try {
- const newCaption = editCaptionInput.getValue();
-
- logic.updatePostCaption(post.id, newCaption);
-
- self.remove(editCaptionForm);
-
- editCaptionForm = undefined;
-
- self.onPostCaptionEditedCallback();
- } catch (error) {
- console.error(error);
-
- alert(error.message);
-
- if (error.message === "post not found")
- self.onPostCaptionEditedCallback();
- }
- });
- });
- }
-
- const postDateTime = new Component(document.createElement("time"));
- postDateTime.setClassName("post__time");
- postDateTime.setText(formatTime(new Date(post.date)));
- this.add(postDateTime);
- }
-
- onPostDeleted(callback) {
- this.onPostDeletedCallback = callback;
- }
-
- onPostCaptionEdited(callback) {
- this.onPostCaptionEditedCallback = callback;
- }
-
- onPostLikeToggled(callback) {
- this.onPostLikeToggledCallback = callback;
- }
-
- onPostFavToggled(callback) {
- this.onPostFavToggledCallback = callback;
- }
-
- onFollowUserToggled(callback) {
- this.onFollowUserToggledCallback = callback;
- }
-}
-
-export default Post;
diff --git a/staff/nerina-castillo/ponies/app/view/home/components/PostList.jsx b/staff/nerina-castillo/ponies/app/view/home/components/PostList.jsx
new file mode 100644
index 000000000..e41c2e1e1
--- /dev/null
+++ b/staff/nerina-castillo/ponies/app/view/home/components/PostList.jsx
@@ -0,0 +1,29 @@
+import logic from '../../../logic/index.mjs'
+
+const { Component } = React
+
+import Post from './Post.jsx'
+
+class PostList extends Component {
+ constructor() {
+ super()
+
+ try {
+ const posts = logic.getAllPosts()
+
+ this.state = { posts }
+ } catch (error) {
+ console.error(error)
+
+ alert(error.message)
+ }
+ }
+
+ render() {
+ return
+ {this.state.posts.map(post => )}
+
+ }
+}
+
+export default PostList
\ No newline at end of file
diff --git a/staff/nerina-castillo/ponies/app/view/home/components/PostList.mjs b/staff/nerina-castillo/ponies/app/view/home/components/PostList.mjs
deleted file mode 100644
index ad031b824..000000000
--- a/staff/nerina-castillo/ponies/app/view/home/components/PostList.mjs
+++ /dev/null
@@ -1,65 +0,0 @@
-import Component from "../../Component.mjs";
-import Post from "./Post.mjs";
-
-import logic from "../../../logic/index.mjs";
-
-class PostList extends Component {
- constructor() {
- super(document.createElement("section"));
-
- this.setClassName("post-list");
- }
-
- clearPosts() {
- for (let i = this.container.children.length - 1; i > -1; i--) {
- const child = this.container.children[i];
-
- this.container.removeChild(child);
- }
- }
-
- listPosts() {
- try {
- const posts = logic.getAllPosts();
-
- const self = this;
-
- posts.forEach((_post) => {
- const post = new Post(_post);
-
- post.onPostDeleted(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onPostCaptionEdited(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onPostLikeToggled(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onPostFavToggled(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- post.onFollowUserToggled(() => {
- self.clearPosts();
- self.listPosts();
- });
-
- self.add(post);
- });
- } catch (error) {
- console.error(error);
-
- alert(error.message);
- }
- }
-}
-
-export default PostList;
diff --git a/staff/nerina-castillo/ponies/app/view/home/index.css b/staff/nerina-castillo/ponies/app/view/home/index.css
index 56fd9c934..53e8a93dc 100644
--- a/staff/nerina-castillo/ponies/app/view/home/index.css
+++ b/staff/nerina-castillo/ponies/app/view/home/index.css
@@ -1,17 +1,22 @@
-@import url(../components/Button.css);
+@import url("./components/Button.css");
+@import url("https://fonts.googleapis.com/css2?family=Advent+Pro:ital,wght@0,100..900;1,100..900&family=Over+the+Rainbow&display=swap");
+@import url("https://fonts.googleapis.com/css2?family=Over+the+Rainbow&display=swap");
-body{
+
+
+body {
font-family: 'Advent pro';
}
+
.view {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
font-size: 1.1rem;
-
+
}
.form {
@@ -20,29 +25,30 @@ body{
gap: .5rem;
min-width: 80%;
margin-bottom: 0%;
-
+
}
.form__field {
display: flex;
flex-direction: column;
gap: .2rem
-
}
.form__input {
- font-size: inherit; border-radius: 5px;
- border:none;
- color:#000000;
+ font-size: inherit;
+ border-radius: 5px;
+ border: none;
+ color: #000000;
padding: .2rem;
box-shadow: black;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
-.form__caption-input{
- font-size: inherit; border-radius: 5px;
- border:none;
- color:#000000;
+.form__caption-input {
+ font-size: inherit;
+ border-radius: 5px;
+ border: none;
+ color: #000000;
padding: .2rem;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
height: 50px;
@@ -58,7 +64,7 @@ body{
padding: .2rem;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
margin-top: 1rem;
-
+
}
.post-list {
@@ -77,12 +83,12 @@ body{
align-items: center;
gap: 0.5rem;
justify-content: space-between;
-
+
}
.post__author {
margin: .5rem;
-
+
}
.post__image {
@@ -104,7 +110,7 @@ body{
font-size: .9rem;
}
-.add-post-button{
+.add-post-button {
background: linear-gradient(to right, #A02BE8, #2fd5d5);
color: white;
border-radius: 5px;
@@ -114,17 +120,17 @@ body{
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
-.post__actions{
- display:flex;
+.post__actions {
+ display: flex;
justify-content: space-around;
}
-.like-button{
+.like-button {
background-color: transparent;
border: none;
-box-shadow: 1px 1px 10px 1px lightgray;
-border-radius: 5px;
+ box-shadow: 1px 1px 10px 1px lightgray;
+ border-radius: 5px;
}
@@ -143,7 +149,7 @@ border-radius: 5px;
padding: .4rem;
}
-.logout-button{
+.logout-button {
background: linear-gradient(to right, #A02BE8, #2fd5d5);
color: white;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
@@ -152,21 +158,21 @@ border-radius: 5px;
height: 25px;
}
-.header__user-name{
+.header__user-name {
margin: 0;
}
-.logo{
- color:linear-gradient(to right, #A02BE8, #2fd5d5);
- font-family:'Over the Rainbow' ;
- height: 20px ;
+.logo {
+ color: linear-gradient(to right, #A02BE8, #2fd5d5);
+ font-family: 'Over the Rainbow';
+ height: 20px;
margin: -30px 0 10px -5px;
}
.main {
margin-top: 3.5rem;
margin-bottom: 3rem;
-
+
}
.footer {
@@ -179,7 +185,6 @@ border-radius: 5px;
background-color: white;
padding: .5rem 0;
box-shadow: 0px -1px 1px lightgray
-
}
.create-post-section {
@@ -190,6 +195,7 @@ border-radius: 5px;
background-color: white;
padding: .5rem;
box-sizing: border-box;
+
}
.create-post-section__title {
@@ -198,6 +204,7 @@ border-radius: 5px;
.create-post-section__buttons {
display: flex;
+ flex-direction: column;
justify-content: center;
- gap: 1rem;
+
}
\ No newline at end of file
diff --git a/staff/nerina-castillo/ponies/app/view/home/index.html b/staff/nerina-castillo/ponies/app/view/home/index.html
index 6655ef297..fa944649e 100644
--- a/staff/nerina-castillo/ponies/app/view/home/index.html
+++ b/staff/nerina-castillo/ponies/app/view/home/index.html
@@ -1,19 +1,58 @@
-
-
-
-
-
- Home
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ Home
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/staff/nerina-castillo/ponies/app/view/home/index.jsx b/staff/nerina-castillo/ponies/app/view/home/index.jsx
new file mode 100644
index 000000000..09ed6b50b
--- /dev/null
+++ b/staff/nerina-castillo/ponies/app/view/home/index.jsx
@@ -0,0 +1,27 @@
+import logic from '../../logic/index.mjs'
+
+import Header from './components/Header'
+import PostList from './components/PostList'
+import Footer from './components/Footer'
+
+const Component = React.Component
+
+class Home extends Component {
+ constructor() {
+ super()
+ }
+
+ render() {
+ return <>
+
+
+
+
+
+
+ >
+ }
+}
+
+const root = ReactDOM.createRoot(document.getElementById('root'))
+root.render()
\ No newline at end of file
diff --git a/staff/nerina-castillo/ponies/app/view/home/index.mjs b/staff/nerina-castillo/ponies/app/view/home/index.mjs
deleted file mode 100644
index 357a6dd70..000000000
--- a/staff/nerina-castillo/ponies/app/view/home/index.mjs
+++ /dev/null
@@ -1,86 +0,0 @@
-import Component from "../Component.mjs";
-import Header from "./components/Header.mjs";
-import PostList from "./components/PostList.mjs";
-import FavPostList from "./components/FavPostList.mjs";
-import FollowingPostList from "./components/FollowingPostList.mjs";
-import Footer from "./components/Footer.mjs";
-
-const home = new Component(document.body);
-const header = new Header();
-home.add(header);
-
-header.onHomeClick(() => {
- if (favPostList && body.has(favPostList)) {
- body.remove(favPostList);
- body.add(postList);
-
- postList.clearPosts();
- postList.listPosts();
- } else if (followingPostList && body.has(followingPostList)) {
- body.remove(followingPostList);
- body.add(postList);
-
- postList.clearPosts();
- postList.listPosts();
- }
-});
-
-let favPostList;
-
-header.onFavsClick(() => {
- if (body.has(postList)) {
- body.remove(postList);
-
- favPostList = new FavPostList();
- body.add(favPostList);
- } else if (followingPostList && body.has(followingPostList)) {
- body.remove(followingPostList);
- }
-
- if (!favPostList) {
- favPostList = new FavPostList();
- }
- body.add(favPostList);
-
- favPostList.clearPosts();
- favPostList.listPosts();
-});
-
-let followingPostList;
-
-header.onFollowsClick(() => {
- if (body.has(postList)) {
- body.remove(postList);
-
- followingPostList = new FollowingPostList();
- body.add(followingPostList);
-
- followingPostList.listPosts();
- } else if (favPostList && body.has(favPostList)) {
- body.remove(favPostList);
- }
- if (!followingPostList) {
- favPostList = new FollowingPostList();
- }
- body.add(followingPostList);
-
- followingPostList.clearPosts();
- followingPostList.listPosts();
-});
-
-const body = new Component(document.createElement("main"));
-body.setClassName("view main");
-home.add(body);
-
-const postList = new PostList();
-body.add(postList);
-
-postList.listPosts();
-
-const footer = new Footer();
-home.add(footer);
-
-footer.onPostCreated(() => {
- postList.clearPosts();
- postList.listPosts();
-});
diff --git a/staff/nerina-castillo/ponies/app/view/login/index.css b/staff/nerina-castillo/ponies/app/view/login/index.css
index d69e29007..c55dfb5c9 100644
--- a/staff/nerina-castillo/ponies/app/view/login/index.css
+++ b/staff/nerina-castillo/ponies/app/view/login/index.css
@@ -1,3 +1,8 @@
+@import url("https://fonts.googleapis.com/css2?family=Advent+Pro:ital,wght@0,100..900;1,100..900&family=Over+the+Rainbow&display=swap");
+
+@import url("https://fonts.googleapis.com/css2?family=Over+the+Rainbow&display=swap");
+
+
body{
margin: 0 ;
diff --git a/staff/nerina-castillo/ponies/app/view/login/index.html b/staff/nerina-castillo/ponies/app/view/login/index.html
index 78bd52619..4667d776c 100644
--- a/staff/nerina-castillo/ponies/app/view/login/index.html
+++ b/staff/nerina-castillo/ponies/app/view/login/index.html
@@ -1,53 +1,158 @@
-
-
-
-
-
- Login
-
-
-
-
-
-
-
-
-
- Login
-
-
-
- Register
-
-
-
-
-
+
+
+
+
+
+ Login
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/staff/nerina-castillo/ponies/app/view/login/index.jsx b/staff/nerina-castillo/ponies/app/view/login/index.jsx
new file mode 100644
index 000000000..a5b52aafc
--- /dev/null
+++ b/staff/nerina-castillo/ponies/app/view/login/index.jsx
@@ -0,0 +1,66 @@
+import logic from '../../logic/index.mjs'
+
+const Component = React.Component
+
+class Login extends Component {
+ constructor() {
+ super()
+ }
+
+ handleRegisterClick(event) {
+ event.preventDefault()
+
+ location.href = '../register'
+ }
+
+ handleLoginSubmit(event) {
+ event.preventDefault()
+
+ const form = event.target
+
+ const usernameInput = form['username-input']
+ const passwordInput = form['password-input']
+
+ const username = usernameInput.value
+ const password = passwordInput.value
+
+ try {
+ logic.loginUser(username, password)
+
+ location.href = '../home'
+ } catch (error) {
+ console.error(error)
+
+ alert(error.message)
+ }
+ }
+
+
+
+ render() {
+ return
+ Ponies
+
+ Login
+
+
+
+ Register
+
+ }
+}
+
+const root = ReactDOM.createRoot(document.getElementById('root'))
+root.render()
\ No newline at end of file
diff --git a/staff/nerina-castillo/ponies/app/view/login/index.mjs b/staff/nerina-castillo/ponies/app/view/login/index.mjs
deleted file mode 100644
index 03e94e186..000000000
--- a/staff/nerina-castillo/ponies/app/view/login/index.mjs
+++ /dev/null
@@ -1,32 +0,0 @@
-import Form from "../components/Form.mjs";
-import Link from "../components/Link.mjs";
-
-import logic from "../../logic/index.mjs";
-
-const loginForm = new Form("form");
-
-loginForm.onSubmit((event) => {
- event.preventDefault();
-
- const usernameInput = document.getElementById("username-input");
- const passwordInput = document.getElementById("password-input");
-
- const username = usernameInput.value;
- const password = passwordInput.value;
-
- try {
- logic.loginUser(username, password);
-
- location.href = "../home";
- } catch (error) {
- alert(error.message);
- }
-});
-
-const registerLink = new Link("a");
-
-registerLink.onClick((event) => {
- event.preventDefault();
-
- location.href = "../register";
-});
diff --git a/staff/nerina-castillo/ponies/app/view/register/index.css b/staff/nerina-castillo/ponies/app/view/register/index.css
index 40c130ba4..18da549eb 100644
--- a/staff/nerina-castillo/ponies/app/view/register/index.css
+++ b/staff/nerina-castillo/ponies/app/view/register/index.css
@@ -1,3 +1,8 @@
+@import url("https://fonts.googleapis.com/css2?family=Advent+Pro:ital,wght@0,100..900;1,100..900&family=Over+the+Rainbow&display=swap");
+
+@import url("https://fonts.googleapis.com/css2?family=Over+the+Rainbow&display=swap");
+
+
body{
margin: 0 ;
}
diff --git a/staff/nerina-castillo/ponies/app/view/register/index.html b/staff/nerina-castillo/ponies/app/view/register/index.html
index 18644b107..33236945e 100644
--- a/staff/nerina-castillo/ponies/app/view/register/index.html
+++ b/staff/nerina-castillo/ponies/app/view/register/index.html
@@ -1,96 +1,158 @@
-
-
-
-
-
- Register
-
-
-
-
-
-
-
-
- Register
-
-
-
- Login
-
-
-
-
-
+
+
+
+
+
+ Register
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/staff/nerina-castillo/ponies/app/view/register/index.jsx b/staff/nerina-castillo/ponies/app/view/register/index.jsx
new file mode 100644
index 000000000..557339ede
--- /dev/null
+++ b/staff/nerina-castillo/ponies/app/view/register/index.jsx
@@ -0,0 +1,96 @@
+// import React from 'react'
+import logic from '../../logic/index.mjs'
+
+const Component = React.Component
+
+class Register extends Component {
+ constructor() {
+ super()
+ }
+
+ handleLoginClick(event) {
+ event.preventDefault()
+
+ location.href = '../login'
+ }
+
+ handleRegisterSubmit(event) {
+ event.preventDefault()
+
+ const form = event.target
+
+ const nameInput = form['name-input']
+ const surnameInput = form['surname-input']
+ const emailInput = form['email-input']
+ const usernameInput = form['username-input']
+ const passwordInput = form['password-input']
+ const passwordRepeatInput = form['password2-input']
+
+ const name = nameInput.value
+ const surname = surnameInput.value
+ const email = emailInput.value
+ const username = usernameInput.value
+ const password = passwordInput.value
+ const passwordRepeat = passwordRepeatInput.value
+
+ try {
+ logic.registerUser(name, surname, email, username, password, passwordRepeat)
+
+ alert('user successfully registered')
+
+ location.href = '../login'
+ } catch (error) {
+ console.error(error)
+
+ alert(error.message)
+ }
+ }
+
+ render() {
+ return
+ Ponies
+
+ Register
+
+
+
+ Login
+
+ }
+}
+
+const root = ReactDOM.createRoot(document.getElementById('root'))
+root.render()
\ No newline at end of file
diff --git a/staff/nerina-castillo/ponies/app/view/register/index.mjs b/staff/nerina-castillo/ponies/app/view/register/index.mjs
deleted file mode 100644
index 946322193..000000000
--- a/staff/nerina-castillo/ponies/app/view/register/index.mjs
+++ /dev/null
@@ -1,51 +0,0 @@
-import Form from "../components/Form.mjs";
-import Link from "../components/Link.mjs";
-
-import logic from "../../logic/index.mjs";
-
-const registerForm = new Form("form");
-
-registerForm.onSubmit((event) => {
- event.preventDefault();
-
- const nameInput = document.getElementById("name-input");
- const surnameInput = document.getElementById("surname-input");
- const emailInput = document.getElementById("email-input");
- const usernameInput = document.getElementById("username-input");
- const passwordInput = document.getElementById("password-input");
- const passwordRepeatInput = document.getElementById("password2-input");
-
- const name = nameInput.value;
- const surname = surnameInput.value;
- const email = emailInput.value;
- const username = usernameInput.value;
- const password = passwordInput.value;
- const passwordRepeat = passwordRepeatInput.value;
-
- try {
- logic.registerUser(
- name,
- surname,
- email,
- username,
- password,
- passwordRepeat
- );
-
- alert("user successfully registered");
-
- location.href = "../login";
- } catch (error) {
- console.error(error);
-
- alert(error.message);
- }
-});
-
-const loginLink = new Link("a");
-
-loginLink.onClick((event) => {
- event.preventDefault();
-
- location.href = "../login";
-});