Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #35

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
32 changes: 29 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
./node_modules
./dist
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
node_modules
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "none"
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
47 changes: 2 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,5 @@
# Vue Dynamic List of Posts
# vue_dynamic-list of-posts

Implement the App with ability to show posts of a current logged-in user.
The user should be able to create a new post with their userId. Each post can
be opened in the sidebar with its comments, can be edited and deleted. There should delete a comment and a
form to add new comments.
[DEMO LINK](https://yuriihlushenko.github.io/vue_dynamic-list-of-posts/)

> Here is [the working version](https://mate-academy.github.io/vue_dynamic-list-of-posts/#/)

1. Learn the `.html` files to get all needed layouts;
1. Initially the `App` shows the `Posts table` and `Create new post` button

- show the `<Loader>` while waiting for the API response;
- show an error notification if `posts` loading fails;
- if the user has no posts show the `No posts yet` notification.

1. Add the `Sidebar--open` class to the sidebar when user click on `Create new post`;

- the form for new post should be appear there immediately;
- add validation to the fields;
- when user click on `Create` component with post details and comments should be appear there immediately ;

1. In the `Post preview` user should see `edit` and `delete` buttons;

- When user click on `Delete`, post should be deleted and sidebar close;
- When user click on `Edit` show edit post form;
- When user click on `Save` in edit mode - show post preview in the sidebar;

1. Add the `Sidebar--open` class to the sidebar when a post is selected;
- the post details should appear there immediately;
- the post commnets should be loaded from the API;
- the `Loader` is shown before comments are loaded;
- `CommentsError` notification is show on loading error;
- `NoComments` message is shown if the post does not have comments yet;
1. Show the `Write a comment` button below the comments
- after click hide the button and show the form to add new comment;
- the form stays visible until the other post is opened;
- the form should be implemented as a separate component;
1. The form requires an author's name and email and a comment text.
- show errors only after the form is submitted;
- remove an error on the field change;
- keep the `name` and `email` after the successful submit but clear a comment text;
- The `Clear` button should also clear all errors;
- Add the `is-loading` class to the submit button while waiting for a response;
- Add the new comment received as a response from the `API` to the end of the list;
1. Implement comment deletion
- Delete the commnet immediately not waiting for the server response to improve the UX.
1. (\*) Handle `Add` and `Delete` errors so the user can retry
16 changes: 0 additions & 16 deletions addPost.html

This file was deleted.

9 changes: 0 additions & 9 deletions comment.html

This file was deleted.

16 changes: 16 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set -e

npm run build

cd dist

echo > .nojekyll

git init
git checkout -B main
git add -A
git commit -m 'deploy'

git push -f https://github.com/YuriiHlushenko/vue_dynamic-list-of-posts.git main:gh-pages

cd-
1 change: 1 addition & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
16 changes: 0 additions & 16 deletions header.html

This file was deleted.

13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
26 changes: 0 additions & 26 deletions inputField.html

This file was deleted.

6 changes: 0 additions & 6 deletions loader/index.html

This file was deleted.

30 changes: 0 additions & 30 deletions login.html

This file was deleted.

21 changes: 0 additions & 21 deletions needToRegister.html

This file was deleted.

3 changes: 0 additions & 3 deletions noCommentsYet.html

This file was deleted.

Loading