-
Notifications
You must be signed in to change notification settings - Fork 9
Updated for Vue 3 and Appwrite 1.8.0 #10
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ yarn-error.log* | |
| pnpm-debug.log* | ||
|
|
||
| # Editor directories and files | ||
| .code-workspace | ||
| .idea | ||
| .vscode | ||
| *.suo | ||
|
|
||
Large diffs are not rendered by default.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <!DOCTYPE html> | ||
| <html lang=""> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <link rel="icon" href="/favicon.ico"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Appwrite TO-DO List</title> | ||
| </head> | ||
| <body> | ||
| <div id="app"></div> | ||
| <script type="module" src="/src/main.js"></script> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "paths": { | ||
| "@/*": ["./src/*"] | ||
| } | ||
| }, | ||
| "exclude": ["node_modules", "dist"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,23 @@ | ||
| { | ||
| "name": "example-database", | ||
| "version": "0.1.0", | ||
| "name": "example-database-vue3", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "engines": { | ||
| "node": "^20.19.0 || >=22.12.0" | ||
| }, | ||
| "scripts": { | ||
| "serve": "vue-cli-service serve", | ||
| "build": "vue-cli-service build", | ||
| "lint": "vue-cli-service lint" | ||
| "dev": "vite", | ||
| "build": "vite build", | ||
| "preview": "vite preview" | ||
| }, | ||
| "dependencies": { | ||
| "appwrite": "^1.1.0", | ||
| "core-js": "^3.6.5", | ||
| "vue": "^2.6.11" | ||
| "vue": "^3.5.22", | ||
| "appwrite": "^21" | ||
| }, | ||
| "devDependencies": { | ||
| "@vue/cli-plugin-babel": "~4.5.0", | ||
| "@vue/cli-plugin-eslint": "~4.5.0", | ||
| "@vue/cli-service": "~4.5.0", | ||
| "babel-eslint": "^10.1.0", | ||
| "eslint": "^6.7.2", | ||
| "eslint-plugin-vue": "^6.2.2", | ||
| "vue-template-compiler": "^2.6.11" | ||
| }, | ||
| "eslintConfig": { | ||
| "root": true, | ||
| "env": { | ||
| "node": true | ||
| }, | ||
| "extends": [ | ||
| "plugin:vue/essential", | ||
| "eslint:recommended" | ||
| ], | ||
| "parserOptions": { | ||
| "parser": "babel-eslint" | ||
| }, | ||
| "rules": {} | ||
| }, | ||
| "browserslist": [ | ||
| "> 1%", | ||
| "last 2 versions", | ||
| "not dead" | ||
| ] | ||
| "@vitejs/plugin-vue": "^6.0.1", | ||
| "vite": "^7.1.12", | ||
| "vite-plugin-vue-devtools": "^8.0.3" | ||
|
Comment on lines
+19
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify the Vite and related package versions. The specified Vite version ( Please search for the latest stable versions to confirm: 🌐 Web query: 💡 Result: As of November 4, 2025:
Sources: Update package.json with correct package versions. Vite's latest stable version is 7.1.2, not 7.1.12. @vitejs/plugin-vue is correctly specified at 6.0.1. However, vite-plugin-vue-devtools's latest stable version is 7.6.5, not 8.0.3. Update lines 19-21 in
🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,121 +1,118 @@ | ||||||
| <template> | ||||||
| <div class="TaskCore"> | ||||||
| <h1>Appwrite TO-DO List</h1> | ||||||
| <div v-for="data in tasks" :key="data.task"> | ||||||
| <Task v-bind:data="data" v-on:refreshData='fetchTasks' /> | ||||||
| </div> | ||||||
| <div class="newTaskForm"> | ||||||
| <input v-model="newTask" placeholder="Add New Task"> | ||||||
| <button v-on:click.prevent="createNewTask"><span>+</span></button> | ||||||
| </div> | ||||||
| </div> | ||||||
| </template> | ||||||
|
|
||||||
| <script> | ||||||
| import { appwrite } from './utils' | ||||||
|
|
||||||
| import Task from './components/Task' | ||||||
|
|
||||||
| export default { | ||||||
| name: 'App', | ||||||
| components: { | ||||||
| Task | ||||||
| }, | ||||||
| data: function() { | ||||||
| return { | ||||||
| tasks: [], | ||||||
| newTask: '' | ||||||
| } | ||||||
| }, | ||||||
| created: function() { | ||||||
| this.fetchTasks() | ||||||
| }, | ||||||
| methods: { | ||||||
| createNewTask: function() { | ||||||
| if (this.newTask === '') { return } | ||||||
|
|
||||||
| let promise = appwrite.database.createDocument('CollectionID', { | ||||||
| task: this.newTask, | ||||||
| done: false, | ||||||
| date: new Date() | ||||||
| }, ['*'], ['*']); | ||||||
|
|
||||||
| promise.then(() => { | ||||||
| this.fetchTasks() | ||||||
| this.newTask = '' | ||||||
| }, function (error) { | ||||||
| console.log(error); // Failure | ||||||
| }); | ||||||
| }, | ||||||
| fetchTasks: function() { | ||||||
| let promise = appwrite.database.listDocuments('CollectionID'); | ||||||
|
|
||||||
| promise.then((response) => { | ||||||
| console.log(response); // Success | ||||||
| this.tasks = response.documents | ||||||
| }, function (error) { | ||||||
| console.log(error); // Failure | ||||||
| }); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| </script> | ||||||
|
|
||||||
| <style> | ||||||
| * { | ||||||
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | ||||||
| } | ||||||
|
|
||||||
| .TaskCore { | ||||||
| width: 500px; | ||||||
| height: auto; | ||||||
| position: absolute; | ||||||
| left: 50%; | ||||||
| top: 50%; | ||||||
| transform: translateX(-50%) translateY(-50%); | ||||||
| box-shadow: 0px 0px 10px black; | ||||||
| padding: 30px; | ||||||
| border-radius: 10px; | ||||||
| text-align: center; | ||||||
| max-height: 80%; | ||||||
| overflow-y: auto; | ||||||
| } | ||||||
|
|
||||||
| .newTaskForm input { | ||||||
| width: calc(100% - 40px); | ||||||
| width: 60%; | ||||||
| box-shadow: 0px 0px 10px black; | ||||||
| height: 40px; | ||||||
| border-radius: 10px; | ||||||
| margin: 0 auto; | ||||||
| line-height: 40px; | ||||||
| text-align: center; | ||||||
| font-size: 25px; | ||||||
| margin-top: 30px; | ||||||
| } | ||||||
|
|
||||||
| .newTaskForm button { | ||||||
| position: relative; | ||||||
| display: block; | ||||||
| margin: 0 auto; | ||||||
| margin-top: 20px; | ||||||
| border: none; | ||||||
| height: 50px; | ||||||
| width: 50px; | ||||||
| background-color: #53f85b; | ||||||
| border-radius: 10px; | ||||||
| transition: 0.5s; | ||||||
| } | ||||||
|
|
||||||
| .newTaskForm button span { | ||||||
| color: white; | ||||||
| font-size: 50px; | ||||||
| line-height: 30px; | ||||||
| } | ||||||
|
|
||||||
| .newTaskForm button:hover { | ||||||
| box-shadow: 0px 0px 10px black; | ||||||
| scale: 1.05; | ||||||
| cursor: pointer; | ||||||
| } | ||||||
| <template> | ||||||
| <div class="TaskCore"> | ||||||
| <h1>Appwrite TO-DO List</h1><div v-for="data in tasks" :key="data.$id || data.task"> | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential key uniqueness issue with fallback. The key binding uses Consider simplifying to: - <div v-for="data in tasks" :key="data.$id || data.task">
+ <div v-for="data in tasks" :key="data.$id">📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| <Task :data="data" @refreshData="fetchTasks" /> | ||||||
| </div> | ||||||
| <div class="newTaskForm"> | ||||||
| <input v-model="newTask" placeholder="Add New Task" /> | ||||||
| <button v-on:click.prevent="createNewTask"><span>+</span></button> | ||||||
| </div> | ||||||
| </div> | ||||||
| </template> | ||||||
|
|
||||||
| <script setup> | ||||||
|
|
||||||
| import { ref, onMounted } from 'vue' | ||||||
| import { appwrite } from './utils.js' | ||||||
|
|
||||||
| import Task from './components/Task.vue' | ||||||
| import { SECRETS } from './secrets.js' | ||||||
|
|
||||||
| const tasks = ref([]) | ||||||
| const newTask = ref('') | ||||||
|
|
||||||
| const fetchTasks = async () => { | ||||||
| try { | ||||||
| const response = await appwrite.database.listDocuments( | ||||||
| SECRETS.DB.databaseId, | ||||||
| SECRETS.DB.tableName, | ||||||
| ) | ||||||
| tasks.value = response.documents || [] | ||||||
| } catch (error) { | ||||||
| console.log(error) | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| const createNewTask = async () => { | ||||||
| if (!newTask.value.trim()) return | ||||||
|
|
||||||
| try { | ||||||
| // Here we don't use a transaction for a single document creation, it could be useful mostly when multiple operations are needed (CF https://appwrite.io/docs/products/databases/transactions) | ||||||
| await appwrite.database.createDocument( | ||||||
| SECRETS.DB.databaseId, | ||||||
| SECRETS.DB.tableName, | ||||||
| 'unique()', | ||||||
| { | ||||||
| task: newTask.value, | ||||||
| done: false, | ||||||
| date: new Date() | ||||||
| }, | ||||||
| ) | ||||||
| newTask.value = '' | ||||||
| await fetchTasks() | ||||||
| } catch (error) { | ||||||
| console.error('createNewTask error', error) | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| onMounted(fetchTasks) | ||||||
| </script> | ||||||
|
|
||||||
| <style> | ||||||
| * { | ||||||
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | ||||||
| } | ||||||
|
|
||||||
| .TaskCore { | ||||||
| width: 500px; | ||||||
| height: auto; | ||||||
| position: absolute; | ||||||
| left: 50%; | ||||||
| top: 50%; | ||||||
| transform: translateX(-50%) translateY(-50%); | ||||||
| box-shadow: 0px 0px 10px black; | ||||||
| padding: 30px; | ||||||
| border-radius: 10px; | ||||||
| text-align: center; | ||||||
| max-height: 80%; | ||||||
| overflow-y: auto; | ||||||
| } | ||||||
|
|
||||||
| .newTaskForm input { | ||||||
| width: calc(100% - 40px); | ||||||
| width: 60%; | ||||||
| box-shadow: 0px 0px 10px black; | ||||||
| height: 40px; | ||||||
| border-radius: 10px; | ||||||
| margin: 0 auto; | ||||||
| line-height: 40px; | ||||||
| text-align: center; | ||||||
| font-size: 25px; | ||||||
| margin-top: 30px; | ||||||
| } | ||||||
|
|
||||||
| .newTaskForm button { | ||||||
| position: relative; | ||||||
| display: block; | ||||||
| margin: 0 auto; | ||||||
| margin-top: 20px; | ||||||
| border: none; | ||||||
| height: 50px; | ||||||
| width: 50px; | ||||||
| background-color: #53f85b; | ||||||
| border-radius: 10px; | ||||||
| transition: 0.5s; | ||||||
| } | ||||||
|
|
||||||
| .newTaskForm button span { | ||||||
| color: white; | ||||||
| font-size: 50px; | ||||||
| line-height: 30px; | ||||||
| } | ||||||
|
|
||||||
| .newTaskForm button:hover { | ||||||
| box-shadow: 0px 0px 10px black; | ||||||
| scale: 1.05; | ||||||
| cursor: pointer; | ||||||
| } | ||||||
| </style> | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify a language code in the
langattribute.The
langattribute is empty, which can affect accessibility and SEO. Please specify an appropriate language code (e.g.,lang="en"for English).Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents