diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..5370727
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,14 @@
+# editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 2
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/index.html b/index.html
index 8388c4b..c3b5ea1 100644
--- a/index.html
+++ b/index.html
@@ -2,9 +2,9 @@
-
+
- Vite + Vue
+ Pinia Vue
diff --git a/package.json b/package.json
index e99efda..e8380c2 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
+ "pinia": "^2.3.1",
"vue": "^3.5.13"
},
"devDependencies": {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ef32212..2351d86 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -8,6 +8,9 @@ importers:
.:
dependencies:
+ pinia:
+ specifier: ^2.3.1
+ version: 2.3.1(vue@3.5.13)
vue:
specifier: ^3.5.13
version: 3.5.13
@@ -308,6 +311,9 @@ packages:
'@vue/compiler-ssr@3.5.13':
resolution: {integrity: sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==}
+ '@vue/devtools-api@6.6.4':
+ resolution: {integrity: sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==}
+
'@vue/reactivity@3.5.13':
resolution: {integrity: sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==}
@@ -356,6 +362,15 @@ packages:
picocolors@1.1.1:
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
+ pinia@2.3.1:
+ resolution: {integrity: sha512-khUlZSwt9xXCaTbbxFYBKDc/bWAGWJjOgvxETwkTN7KRm66EeT1ZdZj6i2ceh9sP2Pzqsbc704r2yngBrxBVug==}
+ peerDependencies:
+ typescript: '>=4.4.4'
+ vue: ^2.7.0 || ^3.5.11
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
postcss@8.5.1:
resolution: {integrity: sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==}
engines: {node: ^10 || ^12 || >=14}
@@ -409,6 +424,17 @@ packages:
yaml:
optional: true
+ vue-demi@0.14.10:
+ resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==}
+ engines: {node: '>=12'}
+ hasBin: true
+ peerDependencies:
+ '@vue/composition-api': ^1.0.0-rc.1
+ vue: ^3.0.0-0 || ^2.6.0
+ peerDependenciesMeta:
+ '@vue/composition-api':
+ optional: true
+
vue@3.5.13:
resolution: {integrity: sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==}
peerDependencies:
@@ -603,6 +629,8 @@ snapshots:
'@vue/compiler-dom': 3.5.13
'@vue/shared': 3.5.13
+ '@vue/devtools-api@6.6.4': {}
+
'@vue/reactivity@3.5.13':
dependencies:
'@vue/shared': 3.5.13
@@ -672,6 +700,14 @@ snapshots:
picocolors@1.1.1: {}
+ pinia@2.3.1(vue@3.5.13):
+ dependencies:
+ '@vue/devtools-api': 6.6.4
+ vue: 3.5.13
+ vue-demi: 0.14.10(vue@3.5.13)
+ transitivePeerDependencies:
+ - '@vue/composition-api'
+
postcss@8.5.1:
dependencies:
nanoid: 3.3.8
@@ -713,6 +749,10 @@ snapshots:
optionalDependencies:
fsevents: 2.3.3
+ vue-demi@0.14.10(vue@3.5.13):
+ dependencies:
+ vue: 3.5.13
+
vue@3.5.13:
dependencies:
'@vue/compiler-dom': 3.5.13
diff --git a/public/logo.svg b/public/logo.svg
new file mode 100644
index 0000000..65bc5e0
--- /dev/null
+++ b/public/logo.svg
@@ -0,0 +1,15 @@
+
+
+
+
diff --git a/public/vite.svg b/public/vite.svg
deleted file mode 100644
index e7b8dfb..0000000
--- a/public/vite.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/assets/vue.svg b/public/vue.svg
similarity index 100%
rename from src/assets/vue.svg
rename to public/vue.svg
diff --git a/src/App.vue b/src/App.vue
index 81c28ec..5c94d15 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,30 +1,96 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
Watched movies ({{movieStore.watchedMovies.length}})
+
+
+ All movies ({{movieStore.totalCount}})
+
+
+
+ No movies
+
+
+
+
+ Search
+
+
-
diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue
deleted file mode 100644
index 546ebbc..0000000
--- a/src/components/HelloWorld.vue
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
- {{ msg }}
-
-
-
-
- Edit
- components/HelloWorld.vue to test HMR
-
-
-
-
- Check out
- create-vue, the official Vue + Vite starter
-
-
- Learn more about IDE Support for Vue in the
- Vue Docs Scaling up Guide.
-
- Click on the Vite and Vue logos to learn more
-
-
-
diff --git a/src/components/Movie.vue b/src/components/Movie.vue
new file mode 100644
index 0000000..94303f6
--- /dev/null
+++ b/src/components/Movie.vue
@@ -0,0 +1,98 @@
+
+
+
![]()
+
+
+ {{movie.original_title}} ({{ new Date(movie.release_date).toLocaleDateString() }})
+
+
{{ movie.overview }}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main.js b/src/main.js
index 2425c0f..b8438e2 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,5 +1,11 @@
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
+import { createPinia } from 'pinia';
-createApp(App).mount('#app')
+const app = createApp(App);
+const pinia = createPinia()
+
+app
+ .use(pinia)
+ .mount('#app')
diff --git a/src/stores/movie-store.js b/src/stores/movie-store.js
new file mode 100644
index 0000000..73f1cf9
--- /dev/null
+++ b/src/stores/movie-store.js
@@ -0,0 +1,47 @@
+import { defineStore } from 'pinia';
+
+export const useMovieStore = defineStore('movieStore', {
+ state: () => ({
+ movies: [
+ {
+ id: 1,
+ original_title: "Spider-Man",
+ overview:
+ "After being bitten by a genetically altered spider at Oscorp, nerdy but endearing high school student Peter Parker is endowed with amazing powers to become the superhero known as Spider-Man.",
+ poster_path: "/gh4cZbhZxyTbgxQPxD0dOudNPTn.jpg",
+ release_date: "2002-05-01",
+ isWatched: false,
+ },
+ {
+ id: 2,
+ original_title: "The Batman",
+ overview:
+ "In his second year of fighting crime, Batman uncovers corruption in Gotham City that connects to his own family while facing a serial killer known as the Riddler.",
+ poster_path: "/b0PlSFdDwbyK0cf5RxwDpaOJQvQ.jpg",
+ release_date: "2022-03-01",
+ isWatched: true,
+ },
+ ],
+ activeTab: 1,
+ }),
+ getters: {
+ watchedMovies: (store) => {
+ return store.movies.filter((el) => el.isWatched)
+ },
+ totalCount: (store) => {
+ return store.movies.length
+ }
+ },
+ actions: {
+ setActiveTab(tab) {
+ this.activeTab = tab
+ },
+ toggleWatchedMovie(id) {
+ const movie = this.movies.find((el) => el.id === id);
+ movie.isWatched = !movie.isWatched
+ },
+ removeMovie(id) {
+ this.movies = this.movies.filter((el) => el.id !== id)
+ }
+ }
+})
diff --git a/src/style.css b/src/style.css
index bb131d6..efeaf68 100644
--- a/src/style.css
+++ b/src/style.css
@@ -1,79 +1,12 @@
-:root {
- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
- line-height: 1.5;
- font-weight: 400;
-
- color-scheme: light dark;
- color: rgba(255, 255, 255, 0.87);
- background-color: #242424;
-
- font-synthesis: none;
- text-rendering: optimizeLegibility;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-a {
- font-weight: 500;
- color: #646cff;
- text-decoration: inherit;
-}
-a:hover {
- color: #535bf2;
-}
+@import url("https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@300;400&display=swap");
body {
margin: 0;
- display: flex;
- place-items: center;
- min-width: 320px;
- min-height: 100vh;
+ background: #f9f9f9;
+ font-family: "Roboto Condensed", sans-serif;
}
-h1 {
- font-size: 3.2em;
- line-height: 1.1;
-}
-
-button {
- border-radius: 8px;
- border: 1px solid transparent;
- padding: 0.6em 1.2em;
- font-size: 1em;
- font-weight: 500;
- font-family: inherit;
- background-color: #1a1a1a;
- cursor: pointer;
- transition: border-color 0.25s;
-}
-button:hover {
- border-color: #646cff;
-}
-button:focus,
-button:focus-visible {
- outline: 4px auto -webkit-focus-ring-color;
-}
-
-.card {
- padding: 2em;
-}
-
-#app {
- max-width: 1280px;
- margin: 0 auto;
- padding: 2rem;
- text-align: center;
-}
-
-@media (prefers-color-scheme: light) {
- :root {
- color: #213547;
- background-color: #ffffff;
- }
- a:hover {
- color: #747bff;
- }
- button {
- background-color: #f9f9f9;
- }
+main {
+ max-width: 600px;
+ margin: auto;
}