├── env.d.ts ├── public └── favicon.ico ├── .vscode └── extensions.json ├── .prettierrc.json ├── tsconfig.json ├── src ├── assets │ ├── logo.svg │ ├── main.css │ └── base.css ├── views │ ├── AboutView.vue │ ├── EventListView.vue │ ├── StudentListView.vue │ └── EventOrganizerView.vue ├── main.ts ├── components │ ├── icons │ │ ├── IconSupport.vue │ │ ├── IconTooling.vue │ │ ├── IconCommunity.vue │ │ ├── IconDocumentation.vue │ │ └── IconEcosystem.vue │ ├── HelloWorld.vue │ ├── StudentCard.vue │ ├── EventCard.vue │ ├── EventCategories.vue │ ├── WelcomeItem.vue │ └── TheWelcome.vue ├── stores │ └── counter.ts ├── type.ts ├── services │ ├── EventService.ts │ └── StudentService.ts ├── router │ └── index.ts └── App.vue ├── tsconfig.app.json ├── tsconfig.node.json ├── index.html ├── .eslintrc.cjs ├── .gitignore ├── vite.config.ts ├── db.json ├── package.json └── README.md /env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab-vee-se331/331-Lab02-Vue-Vite/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"] 3 | } 4 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/prettierrc", 3 | "semi": false, 4 | "tabWidth": 2, 5 | "singleQuote": true, 6 | "printWidth": 100, 7 | "trailingComma": "none" 8 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { 5 | "path": "./tsconfig.node.json" 6 | }, 7 | { 8 | "path": "./tsconfig.app.json" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /src/assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/views/AboutView.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 16 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | // import './assets/main.css' 2 | 3 | 4 | import { createApp } from 'vue' 5 | import { createPinia } from 'pinia' 6 | 7 | import App from './App.vue' 8 | import router from './router' 9 | 10 | const app = createApp(App) 11 | 12 | app.use(createPinia()) 13 | app.use(router) 14 | 15 | app.mount('#app') 16 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@vue/tsconfig/tsconfig.dom.json", 3 | "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], 4 | "exclude": ["src/**/__tests__/*"], 5 | "compilerOptions": { 6 | "composite": true, 7 | "baseUrl": ".", 8 | "paths": { 9 | "@/*": ["./src/*"] 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/components/icons/IconSupport.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node18/tsconfig.json", 3 | "include": [ 4 | "vite.config.*", 5 | "vitest.config.*", 6 | "cypress.config.*", 7 | "nightwatch.conf.*", 8 | "playwright.config.*" 9 | ], 10 | "compilerOptions": { 11 | "composite": true, 12 | "module": "ESNext", 13 | "types": ["node"] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/stores/counter.ts: -------------------------------------------------------------------------------- 1 | import { ref, computed } from 'vue' 2 | import { defineStore } from 'pinia' 3 | 4 | export const useCounterStore = defineStore('counter', () => { 5 | const count = ref(0) 6 | const doubleCount = computed(() => count.value * 2) 7 | function increment() { 8 | count.value++ 9 | } 10 | 11 | return { count, doubleCount, increment } 12 | }) 13 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | require('@rushstack/eslint-patch/modern-module-resolution') 3 | 4 | module.exports = { 5 | root: true, 6 | 'extends': [ 7 | 'plugin:vue/vue3-essential', 8 | 'eslint:recommended', 9 | '@vue/eslint-config-typescript', 10 | '@vue/eslint-config-prettier/skip-formatting' 11 | ], 12 | parserOptions: { 13 | ecmaVersion: 'latest' 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | .DS_Store 12 | dist 13 | dist-ssr 14 | coverage 15 | *.local 16 | 17 | /cypress/videos/ 18 | /cypress/screenshots/ 19 | 20 | # Editor directories and files 21 | .vscode/* 22 | !.vscode/extensions.json 23 | .idea 24 | *.suo 25 | *.ntvs* 26 | *.njsproj 27 | *.sln 28 | *.sw? 29 | -------------------------------------------------------------------------------- /vite.config.ts: -------------------------------------------------------------------------------- 1 | import { fileURLToPath, URL } from 'node:url' 2 | 3 | import { defineConfig } from 'vite' 4 | import vue from '@vitejs/plugin-vue' 5 | 6 | // https://vitejs.dev/config/ 7 | export default defineConfig({ 8 | plugins: [ 9 | vue(), 10 | ], 11 | resolve: { 12 | alias: { 13 | '@': fileURLToPath(new URL('./src', import.meta.url)) 14 | } 15 | }, 16 | server : { 17 | port : 3000 18 | } 19 | }) 20 | -------------------------------------------------------------------------------- /src/type.ts: -------------------------------------------------------------------------------- 1 | export interface EventItem { 2 | id : number 3 | category : string 4 | title : string 5 | description : string 6 | location : string 7 | date : string 8 | time : string 9 | organizer : string 10 | } 11 | 12 | export interface StudentItem { 13 | id : number 14 | studentId : string 15 | name : string 16 | surname : string 17 | gpa : number 18 | image : string 19 | penAmount : string 20 | description : string 21 | } -------------------------------------------------------------------------------- /src/services/EventService.ts: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import type { AxiosInstance, AxiosResponse } from 'axios' 3 | import type { EventItem } from '@/type' 4 | 5 | const apiClient: AxiosInstance = axios.create({ 6 | baseURL: 'http://localhost:3004', 7 | withCredentials: false, 8 | headers: { 9 | Accept: 'application/json', 10 | 'Content-Type': 'application/json' 11 | } 12 | }) 13 | 14 | export default { 15 | getEvent(): Promise> { 16 | return apiClient.get('/events') 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/services/StudentService.ts: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import type { AxiosInstance, AxiosResponse } from 'axios' 3 | import type { StudentItem } from '@/type' 4 | 5 | const apiClient: AxiosInstance = axios.create({ 6 | baseURL: 'https://dv-student-backend-2019.appspot.com', 7 | withCredentials: false, 8 | headers: { 9 | Accept: 'application/json', 10 | 'Content-Type': 'application/json' 11 | } 12 | }) 13 | 14 | export default { 15 | getEvent(): Promise> { 16 | return apiClient.get('/students') 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/assets/main.css: -------------------------------------------------------------------------------- 1 | @import './base.css'; 2 | 3 | #app { 4 | max-width: 1280px; 5 | margin: 0 auto; 6 | padding: 2rem; 7 | 8 | font-weight: normal; 9 | } 10 | 11 | a, 12 | .green { 13 | text-decoration: none; 14 | color: hsla(160, 100%, 37%, 1); 15 | transition: 0.4s; 16 | } 17 | 18 | @media (hover: hover) { 19 | a:hover { 20 | background-color: hsla(160, 100%, 37%, 0.2); 21 | } 22 | } 23 | 24 | @media (min-width: 1024px) { 25 | body { 26 | display: flex; 27 | place-items: center; 28 | } 29 | 30 | #app { 31 | display: grid; 32 | grid-template-columns: 1fr 1fr; 33 | padding: 0 2rem; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/views/EventListView.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 22 | 23 | 30 | -------------------------------------------------------------------------------- /src/views/StudentListView.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 21 | 22 | 29 | -------------------------------------------------------------------------------- /src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 17 | 18 | 42 | -------------------------------------------------------------------------------- /src/components/StudentCard.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 21 | 22 | -------------------------------------------------------------------------------- /src/router/index.ts: -------------------------------------------------------------------------------- 1 | import { createRouter, createWebHistory } from 'vue-router' 2 | import EventListView from '../views/EventListView.vue' 3 | import AboutView from '../views/AboutView.vue' 4 | import EventOrganizerView from '../views/EventOrganizerView.vue' 5 | import StudentListView from "../views/StudentListView.vue" 6 | const router = createRouter({ 7 | history: createWebHistory(import.meta.env.BASE_URL), 8 | routes: [ 9 | { 10 | path: '/', 11 | name: 'EventList', 12 | component: EventListView 13 | }, 14 | { 15 | path: '/about', 16 | name: 'about', 17 | component: AboutView 18 | }, 19 | { 20 | path: '/organizer', 21 | name: 'organizer', 22 | component: EventOrganizerView 23 | }, 24 | { 25 | path: '/student', 26 | name: 'student', 27 | component: StudentListView 28 | }, 29 | ] 30 | }) 31 | 32 | export default router 33 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | 15 | 51 | -------------------------------------------------------------------------------- /src/components/icons/IconTooling.vue: -------------------------------------------------------------------------------- 1 | 2 | 20 | -------------------------------------------------------------------------------- /src/components/icons/IconCommunity.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /db.json: -------------------------------------------------------------------------------- 1 | { 2 | "events": [ 3 | { 4 | "id": 123, 5 | "category": "animal welfare", 6 | "title": "Cat Adoption Day", 7 | "description": "Find your new feline friend at this event.", 8 | "location": "Meow Town", 9 | "date": "January 28, 2022", 10 | "time": "12:00", 11 | "organizer": "Kat Laydee" 12 | }, 13 | { 14 | "id": 456, 15 | "category": "food", 16 | "title": "Community Gardening", 17 | "description": "Join us as we tend to the community edible plants.", 18 | "location": "Flora City", 19 | "date": "March 14, 2022", 20 | "time": "10:00", 21 | "organizer": "Fern Pollin" 22 | }, 23 | { 24 | "id": 789, 25 | "category": "sustainability", 26 | "title": "Beach Cleanup", 27 | "description": "Help pick up trash along the shore.", 28 | "location": "Playa Del Carmen", 29 | "date": "July 22, 2022", 30 | "time": "11:00", 31 | "organizer": "Carey Wales" 32 | } 33 | ] 34 | } -------------------------------------------------------------------------------- /src/components/icons/IconDocumentation.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-real-world", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "concurrently \"json-server --watch db.json --port 3004\" \" vite\" ", 7 | "build": "run-p type-check build-only", 8 | "preview": "vite preview", 9 | "build-only": "vite build", 10 | "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false", 11 | "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", 12 | "format": "prettier --write src/" 13 | }, 14 | "dependencies": { 15 | "axios": "^1.4.0", 16 | "json-server": "^0.17.3", 17 | "pinia": "^2.1.3", 18 | "vue": "^3.3.4", 19 | "vue-router": "^4.2.2" 20 | }, 21 | "devDependencies": { 22 | "@rushstack/eslint-patch": "^1.2.0", 23 | "@tsconfig/node18": "^2.0.1", 24 | "@types/node": "^18.16.17", 25 | "@vitejs/plugin-vue": "^4.2.3", 26 | "@vue/eslint-config-prettier": "^7.1.0", 27 | "@vue/eslint-config-typescript": "^11.0.3", 28 | "@vue/tsconfig": "^0.4.0", 29 | "eslint": "^8.39.0", 30 | "eslint-plugin-vue": "^9.11.0", 31 | "npm-run-all": "^4.1.5", 32 | "prettier": "^2.8.8", 33 | "typescript": "~5.0.4", 34 | "vite": "^4.3.9", 35 | "vue-tsc": "^1.6.5" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/components/EventCard.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 21 | 34 | 35 | -------------------------------------------------------------------------------- /src/components/EventCategories.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 21 | 34 | 35 | -------------------------------------------------------------------------------- /src/views/EventOrganizerView.vue: -------------------------------------------------------------------------------- 1 | 45 | 46 | 52 | 53 | 60 | -------------------------------------------------------------------------------- /src/components/WelcomeItem.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-real-world 2 | 3 | This template should help get you started developing with Vue 3 in Vite. 4 | 5 | ## Recommended IDE Setup 6 | 7 | [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). 8 | 9 | ## Type Support for `.vue` Imports in TS 10 | 11 | TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. 12 | 13 | If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: 14 | 15 | 1. Disable the built-in TypeScript Extension 16 | 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette 17 | 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` 18 | 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette. 19 | 20 | ## Customize configuration 21 | 22 | See [Vite Configuration Reference](https://vitejs.dev/config/). 23 | 24 | ## Project Setup 25 | 26 | ```sh 27 | npm install 28 | ``` 29 | 30 | ### Compile and Hot-Reload for Development 31 | 32 | ```sh 33 | npm run dev 34 | ``` 35 | 36 | ### Type-Check, Compile and Minify for Production 37 | 38 | ```sh 39 | npm run build 40 | ``` 41 | 42 | ### Lint with [ESLint](https://eslint.org/) 43 | 44 | ```sh 45 | npm run lint 46 | ``` 47 | -------------------------------------------------------------------------------- /src/components/icons/IconEcosystem.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /src/assets/base.css: -------------------------------------------------------------------------------- 1 | /* color palette from */ 2 | :root { 3 | --vt-c-white: #ffffff; 4 | --vt-c-white-soft: #f8f8f8; 5 | --vt-c-white-mute: #f2f2f2; 6 | 7 | --vt-c-black: #181818; 8 | --vt-c-black-soft: #222222; 9 | --vt-c-black-mute: #282828; 10 | 11 | --vt-c-indigo: #2c3e50; 12 | 13 | --vt-c-divider-light-1: rgba(60, 60, 60, 0.29); 14 | --vt-c-divider-light-2: rgba(60, 60, 60, 0.12); 15 | --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65); 16 | --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48); 17 | 18 | --vt-c-text-light-1: var(--vt-c-indigo); 19 | --vt-c-text-light-2: rgba(60, 60, 60, 0.66); 20 | --vt-c-text-dark-1: var(--vt-c-white); 21 | --vt-c-text-dark-2: rgba(235, 235, 235, 0.64); 22 | } 23 | 24 | /* semantic color variables for this project */ 25 | :root { 26 | --color-background: var(--vt-c-white); 27 | --color-background-soft: var(--vt-c-white-soft); 28 | --color-background-mute: var(--vt-c-white-mute); 29 | 30 | --color-border: var(--vt-c-divider-light-2); 31 | --color-border-hover: var(--vt-c-divider-light-1); 32 | 33 | --color-heading: var(--vt-c-text-light-1); 34 | --color-text: var(--vt-c-text-light-1); 35 | 36 | --section-gap: 160px; 37 | } 38 | 39 | @media (prefers-color-scheme: dark) { 40 | :root { 41 | --color-background: var(--vt-c-black); 42 | --color-background-soft: var(--vt-c-black-soft); 43 | --color-background-mute: var(--vt-c-black-mute); 44 | 45 | --color-border: var(--vt-c-divider-dark-2); 46 | --color-border-hover: var(--vt-c-divider-dark-1); 47 | 48 | --color-heading: var(--vt-c-text-dark-1); 49 | --color-text: var(--vt-c-text-dark-2); 50 | } 51 | } 52 | 53 | *, 54 | *::before, 55 | *::after { 56 | box-sizing: border-box; 57 | margin: 0; 58 | font-weight: normal; 59 | } 60 | 61 | body { 62 | min-height: 100vh; 63 | color: var(--color-text); 64 | background: var(--color-background); 65 | transition: color 0.5s, background-color 0.5s; 66 | line-height: 1.6; 67 | font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 68 | Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; 69 | font-size: 15px; 70 | text-rendering: optimizeLegibility; 71 | -webkit-font-smoothing: antialiased; 72 | -moz-osx-font-smoothing: grayscale; 73 | } 74 | -------------------------------------------------------------------------------- /src/components/TheWelcome.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 87 | --------------------------------------------------------------------------------