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 #54

Open
wants to merge 14 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
46 changes: 46 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy static content to Pages

on:
push:
branches: ['develop']

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write


concurrency:
group: 'pages'
cancel-in-progress: true

jobs:

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
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
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}
81 changes: 32 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
# 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.

> 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;
- Bulma is required to have all styles
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
# Simple Blog Application
[Demo](https://iyehorova.github.io/vue_dynamic-list-of-posts/)

This is a basic blog application built with Vue 3 using the Composition API. The app connects to an API to manage user registration, posts, and comments.

## Features
- **User Registration:**

- Upon entering an email, the app checks if the user is registered.

- If the email is not in the database, the app prompts the user to enter a name for quick registration, without requiring a password.

- **Posts:**

- After login or registration, the user sees a list of their posts.
- New users start with an empty post list and can add new posts using a form with title and text fields.
- Posts can be **added**, **edited**, or **deleted**.

- Comments:

- Users can add or delete comments for each post.

### Usage
1. Enter your email on the login screen.
2. If the email is not registered, provide your name to complete registration.
3. After logging in, you’ll be redirected to the posts page:
- Add new posts with the "Add Post" button.
- Edit or delete existing posts.
4. Open a post to add or remove comments as needed.

### Technologies Used
**Vue 3 | Composition API**
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: 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>List of posts</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
26 changes: 0 additions & 26 deletions inputField.html

This file was deleted.

8 changes: 8 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": ["node_modules", "dist"]
}
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