Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Battlesquid committed Feb 16, 2025
1 parent baa5d29 commit a9fc5d3
Show file tree
Hide file tree
Showing 59 changed files with 8,987 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div align="center">
<img src="./assets/qnaplus.png">
<h1>webapp</h1>
<p>Q&A Web Client for the <a href="https://www.robotevents.com/V5RC/2024-2025/QA/">VEX Robotics Q&A</a>.
</p>
<a href="https://github.com/qnaplus/webapp/stargazers">
<img src="https://img.shields.io/github/stars/qnaplus/webapp?color=577BB5&labelColor=1A1B26&style=for-the-badge">
</a>
<a href="../LICENSE.md">
<img src="https://img.shields.io/github/license/qnaplus/webapp?color=C0CAF5&labelColor=1A1B26&style=for-the-badge">
</a>
</div>
Binary file added .github/assets/qnaplus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions .github/workflows/neat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Neat

on:
pull_request:
types: [opened, reopened, edited, synchronize]
branches:
- master

jobs:
neat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 22.13.1
- run: yarn install
- run: yarn neat
17 changes: 17 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on: [push]

jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name=qnaplus
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
*.tsbuildinfo

lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.swp

pids
logs
results
tmp

# Build
public/css/main.css

# Coverage reports
coverage

# Dependency directory
node_modules
bower_components

# Editors
.idea
*.iml

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
dist

# API keys and secrets
/.env*
.flaskenv*
!.env.project
!.env.vault
!.env.template

.turbo

out/
.env*
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
30 changes: 30 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignore": [".turbo", "dist", "node_modules"]
},
"formatter": {
"enabled": true,
"indentStyle": "tab"
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
}
}
7 changes: 7 additions & 0 deletions cf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

if [ "$CF_PAGES_BRANCH" == "dev" ]; then
yarn build --mode development
else
yarn build
fi
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" type="image/svg+xml" href="icons/qnaplus.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>%VITE_APP_NAME%</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
69 changes: 69 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "@qnaplus/web",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vue-tsc && vite",
"build": "vite build",
"preview": "vite preview",
"neat": "biome check .",
"neat:fix": "biome check . --write",
"clean": "rimraf dist .turbo",
"clean:modules": "rimraf node_modules",
"clean:full": "yarn clean && yarn clean:modules"
},
"dependencies": {
"@primevue/themes": "^4.0.0",
"@supabase/supabase-js": "^2.48.1",
"@vueuse/core": "^10.9.0",
"@vueuse/integrations": "^10.8.0",
"@vueuse/rxjs": "^10.11.0",
"deep-equal": "^2.2.3",
"dexie": "^4.0.7",
"htmlparser2": "^9.1.0",
"minisearch": "^6.3.0",
"primeflex": "^3.3.1",
"primeicons": "^6.0.1",
"primevue": "^4.0.0",
"rxjs": "^7.8.1",
"sanitize-html": "^2.13.0",
"tailwindcss-primeui": "^0.3.4",
"uuid": "^11.0.5",
"virtua": "^0.28.0",
"vue": "^3.4.15",
"vue-draggable-plus": "^0.5.0",
"vue-router": "4"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@qnaplus/scraper": "^2.0.2",
"@tailwindcss/typography": "^0.5.15",
"@types/deep-equal": "^1.0.4",
"@types/sanitize-html": "^2.11.0",
"@vite-pwa/assets-generator": "^0.2.4",
"@vitejs/plugin-vue": "^5.0.4",
"autoprefixer": "^10.4.19",
"domhandler": "^5.0.3",
"postcss": "^8.4.39",
"primeclt": "^0.1.5",
"rimraf": "^6.0.1",
"sass": "^1.71.1",
"tailwindcss": "^3.4.6",
"typescript": "^5.2.2",
"vite": "^5.2.10",
"vite-plugin-pwa": "^0.20.0",
"vue-tsc": "^2.0.28",
"workbox-window": "^7.1.0",
"wrangler": "^3.109.1"
},
"resolutions": {
"sharp": "0.32.6",
"sharp-ico": "0.1.5"
},
"volta": {
"node": "22.13.1",
"yarn": "1.22.22"
},
"packageManager": "[email protected]"
}
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
Binary file added public/icons/qnaplus-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/qnaplus-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/qnaplus-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/qnaplus-64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/qnaplus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<script setup lang="ts">
import ProgressSpinner from "primevue/progressspinner";
import { provide, ref } from "vue";
import { loadMinisearch } from "./composable/useSearch";
import {
type QnaplusAppData,
database,
getAppData,
setupDatabase,
} from "./database";
const loading = ref<boolean>(true);
const appdata = ref<QnaplusAppData>();
provide("appdata", appdata);
const appname = import.meta.env.VITE_APP_NAME;
const startup = async () => {
try {
await setupDatabase();
const data = await getAppData();
appdata.value = data;
const questions = await database.questions.toArray();
await loadMinisearch(questions);
loading.value = false;
} catch (e) {
console.error(e);
}
};
startup();
</script>

<template>
<div v-if="loading" class="flex flex-row h-screen-mobile justify-center items-center gap-x-4">
<h1 class="text-xl font-semibold">{{ appname }}</h1>
<ProgressSpinner style="width: 40px; height: 40px; margin: 0;" strokeWidth="6" fill="transparent" animationDuration="0.5s" />
</div>
<div v-else class="flex flex-column w-full h-screen p-component">
<Suspense>
<router-view class="w-full"></router-view>
</Suspense>
</div>
</template>

<style>
@import "styles";
</style>
21 changes: 21 additions & 0 deletions src/components/question/Blockquote.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup lang="ts">
import type { Node as ParserNode } from "domhandler";
import {
resolveQuestionComponent,
resolveQuestionComponentProps,
} from "../../composable/componentMap";
defineProps<{
children: ParserNode[];
}>();
</script>

<template>
<blockquote class="p-3 border-l-2 bg-surface-900 border-l-surface-800 not-prose">
<component :is="resolveQuestionComponent(child)" v-bind="resolveQuestionComponentProps(child)"
v-for="child in children" />
</blockquote>
</template>

<style scoped>
</style>
18 changes: 18 additions & 0 deletions src/components/question/Emphasis.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script setup lang="ts">
import type { Node as ParserNode } from "domhandler";
import {
resolveQuestionComponent,
resolveQuestionComponentProps,
} from "../../composable/componentMap";
defineProps<{
children: ParserNode[];
}>();
</script>

<template>
<em>
<component :is="resolveQuestionComponent(child)" v-bind="resolveQuestionComponentProps(child)"
v-for="child in children" />
</em>
</template>
22 changes: 22 additions & 0 deletions src/components/question/Image.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script setup lang="ts">
import Image from "primevue/image";
defineProps<{
src: string;
height: number;
preview: boolean;
}>();
</script>

<template>
<div>
<Image :src="src" :width="height" :preview="preview" />
</div>
</template>

<style>
.fit-image {
max-width: 100%;
object-fit: contain;
}
</style>
19 changes: 19 additions & 0 deletions src/components/question/Link.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script setup lang="ts">
import type { Node as ParserNode } from "domhandler";
import {
resolveQuestionComponent,
resolveQuestionComponentProps,
} from "../../composable/componentMap";
defineProps<{
href: string;
children: ParserNode[];
}>();
</script>

<template>
<a :href="href">
<component :is="resolveQuestionComponent(child)" v-bind="resolveQuestionComponentProps(child)"
v-for="child in children" />
</a>
</template>
Loading

0 comments on commit a9fc5d3

Please sign in to comment.