Compare commits
No commits in common. "main" and "master" have entirely different histories.
21 changed files with 2330 additions and 0 deletions
15
.eslintrc.cjs
Normal file
15
.eslintrc.cjs
Normal file
|
@ -0,0 +1,15 @@
|
|||
module.exports = {
|
||||
root: true,
|
||||
extends: ['eslint:recommended', 'prettier'],
|
||||
plugins: ['svelte3'],
|
||||
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2019
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
es2017: true,
|
||||
node: true
|
||||
}
|
||||
};
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
6
.prettierrc
Normal file
6
.prettierrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"useTabs": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100
|
||||
}
|
38
README.md
Normal file
38
README.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# create-svelte
|
||||
|
||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);
|
||||
|
||||
## Creating a project
|
||||
|
||||
If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm init svelte@next
|
||||
|
||||
# create a new project in my-app
|
||||
npm init svelte@next my-app
|
||||
```
|
||||
|
||||
> Note: the `@next` is temporary
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
Before creating a production version of your app, install an [adapter](https://kit.svelte.dev/docs#adapters) for your target environment. Then:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
|
10
jsconfig.json
Normal file
10
jsconfig.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"$lib": ["src/lib"],
|
||||
"$lib/*": ["src/lib/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
|
||||
}
|
1994
package-lock.json
generated
Normal file
1994
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
28
package.json
Normal file
28
package.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "~TODO~",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "svelte-kit dev",
|
||||
"build": "svelte-kit build",
|
||||
"preview": "svelte-kit preview",
|
||||
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^20.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@sveltejs/kit": "next",
|
||||
"autoprefixer": "^10.3.2",
|
||||
"eslint": "^7.22.0",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-svelte3": "^3.2.0",
|
||||
"prettier": "~2.2.1",
|
||||
"prettier-plugin-svelte": "^2.2.0",
|
||||
"svelte": "^3.34.0",
|
||||
"tailwindcss": "^2.2.7"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"jsonfile": "^6.1.0"
|
||||
}
|
||||
}
|
6
postcss.config.cjs
Normal file
6
postcss.config.cjs
Normal file
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
plugins: {
|
||||
autoprefixer: {},
|
||||
tailwindcss: {},
|
||||
},
|
||||
}
|
12
src/app.html
Normal file
12
src/app.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
%svelte.head%
|
||||
</head>
|
||||
<body>
|
||||
<div id="svelte">%svelte.body%</div>
|
||||
</body>
|
||||
</html>
|
4
src/components/nav.svelte
Normal file
4
src/components/nav.svelte
Normal file
|
@ -0,0 +1,4 @@
|
|||
<nav class="flex justify-center w-full">
|
||||
<a class="mx-4 text-lg" href="/">Home</a>
|
||||
<a class="mx-4 text-lg" href="/about">About</a>
|
||||
</nav>
|
8
src/components/tagItem.svelte
Normal file
8
src/components/tagItem.svelte
Normal file
|
@ -0,0 +1,8 @@
|
|||
<script>
|
||||
import { fade } from 'svelte/transition';
|
||||
export let tag;
|
||||
</script>
|
||||
|
||||
<a class="list-none p-6 bg-gray-100 text-gray-800 text-center rounded-md shadow-sm hover:shadow-md flex flex-col items-center" href={`/tag/${tag}`} transition:fade>
|
||||
<h2 class="lowercase text-xl">{tag}</h2>
|
||||
</a>
|
23
src/datastore.js
Normal file
23
src/datastore.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { writable } from 'svelte/store';
|
||||
|
||||
export const data = writable([]);
|
||||
export const tagslist = writable([]);
|
||||
|
||||
let loaded = false;
|
||||
|
||||
export const fetchData = async () => {
|
||||
try {
|
||||
if (loaded) return;
|
||||
//const data_source = '../tags.json';
|
||||
const data_source = `https://wenotes.oeru.org/resources/feed-sources.json`;
|
||||
const res = await fetch(data_source);
|
||||
const data_json = await res.json();
|
||||
|
||||
data.set(data_json);
|
||||
tagslist.set(data_json.tags);
|
||||
tagslist.subscribe(array => console.log('tagslist: ', array));
|
||||
loaded = true;
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
1
src/global.d.ts
vendored
Normal file
1
src/global.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference types="@sveltejs/kit" />
|
14
src/routes/__layout.svelte
Normal file
14
src/routes/__layout.svelte
Normal file
|
@ -0,0 +1,14 @@
|
|||
<script>
|
||||
import Nav from "../components/nav.svelte";
|
||||
</script>
|
||||
|
||||
<div class="p-8 max-w-6xl mx-auto">
|
||||
<Nav/>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
</style>
|
4
src/routes/about.svelte
Normal file
4
src/routes/about.svelte
Normal file
|
@ -0,0 +1,4 @@
|
|||
<h1 class="text-4xl text-center my-8 uppercase">About</h1>
|
||||
<p>This is the <a href="https://oerfoundation.org">OER Foundation</a>'s app for editing its canonical course codes for the benefit of its <a href="https://git.oeru.org/oeru/wenotes">WEnotes</a> web content aggregation system.</p>
|
||||
<p>It builds on the <a href="https://svelte.dev">Svelte</a> compiled Javascript environment, and makes use of the new (at the time of this writing) <a href="https://kit.svelte.dev">SvelteKit</a> platform.</p>
|
||||
<p>The source code for this application, like all of the OER Foundation's code, is <a href="https://git.oeru.org/oeru/coursetags">available</a> under a <a href="https://copyleft.org">Copyleft</a> license.</p>
|
66
src/routes/index.svelte
Normal file
66
src/routes/index.svelte
Normal file
|
@ -0,0 +1,66 @@
|
|||
<script>
|
||||
import "../styles/tailwind.css";
|
||||
import TagItem from "../components/tagItem.svelte";
|
||||
import {tagslist, data, fetchData} from "../datastore.js";
|
||||
|
||||
let searchTerm = "";
|
||||
let filteredTags = [];
|
||||
let num_tags = 0;
|
||||
let tag = "";
|
||||
|
||||
function saveTag() {
|
||||
console.log('running saveTag with tag: '+ tag);
|
||||
if (filteredTags.includes(tag)) {
|
||||
console.log('We already have tag ', tag);
|
||||
return;
|
||||
}
|
||||
$tagslist = [...$tagslist, tag].sort();
|
||||
console.log('tags: ', $tagslist);
|
||||
}
|
||||
|
||||
$: {
|
||||
if (searchTerm) {
|
||||
//console.log('$tagslist: ', $tagslist);
|
||||
filteredTags = $tagslist.filter(tag => tag.toLowerCase().includes(searchTerm.toLowerCase()));
|
||||
} else {
|
||||
//console.log('$tagslist: ', $tagslist);
|
||||
filteredTags = [...$tagslist];
|
||||
}
|
||||
}
|
||||
$: {
|
||||
num_tags = $tagslist.length;
|
||||
}
|
||||
fetchData();
|
||||
//tagslist.subscribe(tags => sortTags(tags));
|
||||
//console.log('$tagslist: ', $tagslist);
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Course Tag Manager</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="text-4xl my-8 uppercase">WEnotes Course Tag Manager</h1>
|
||||
|
||||
<p>Number of tags: {num_tags}</p>
|
||||
|
||||
<div class="py-4">
|
||||
<form on:submit|preventDefault={saveTag}>
|
||||
<label>Add a tag:
|
||||
<input class="max-w-sm rounded-md text-md p-4 border-2 border-gray-200" bind:value={tag}>
|
||||
<button class="py-2 px-4 font-semibold rounded-lg shadow-md text-white bg-green-500 hover:bg-green-700" disabled={!tag}>Save</button>
|
||||
</label>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<label>Filter tags:
|
||||
<input class="max-w-sm rounded-md text-md p-4 border-2 border-gray-200" bind:value={searchTerm} placeholder="Type to filter tags">
|
||||
</label>
|
||||
|
||||
<div class="py-4 grid gap-4 lg:grid-cols-6 md:grid-cols-4 sm:grid-cols-2 grid-cols-1">
|
||||
{#each filteredTags as tag}
|
||||
<TagItem tag={tag}/>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
|
||||
<p>These are used by WEnotes aggregators to compile a feed of learner activity across the open Internet.</p>
|
20
src/styles/tailwind.css
Normal file
20
src/styles/tailwind.css
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* from https://dev.to/kematzy/storybook-setup-with-vite-svelte-kit-tailwind-css-221j */
|
||||
|
||||
/* Injects Tailwind's base styles & any base styles registered by plugins. */
|
||||
@tailwind base;
|
||||
|
||||
@layer base { /* custom CSS goes here */ }
|
||||
|
||||
/* Injects Tailwind's component classes & any component classes registered by plugins. */
|
||||
@tailwind components;
|
||||
|
||||
@layer components { /* custom CSS goes here */ }
|
||||
|
||||
/* Injects Tailwind's utility classes & any utility classes registered by plugins. */
|
||||
@tailwind utilities;
|
||||
|
||||
@layer utilities { /* custom CSS goes here */ }
|
||||
|
||||
/* Directive controlling where Tailwind injects responsive variations of utilities.
|
||||
By default Tailwind normally append these at the end of your stylesheet. */
|
||||
@tailwind screens;
|
59
src/tags.json
Normal file
59
src/tags.json
Normal file
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"tags": [
|
||||
"art101", "art102", "art103",
|
||||
"ast1000",
|
||||
"bman111",
|
||||
"ccom101", "ccom102", "ccom103",
|
||||
"cmt101",
|
||||
"csf101", "csf102", "csf103", "csf104",
|
||||
"ctvsd0", "ctvsd1", "ctvsd2", "ctvsd3", "ctvsd4", "ctvsd5", "ctvsd6",
|
||||
"ds4oer","ds4oers",
|
||||
"edem630",
|
||||
"enga101", "enga102", "enga103", "enga104",
|
||||
"eths101",
|
||||
"extafr100", "extafr101", "extafr102", "extafr103", "extafr104", "extafr105", "extafr106",
|
||||
"gfs101",
|
||||
"ient101", "ient102", "ient103",
|
||||
"iet101", "iet102", "iet103", "iet104",
|
||||
"ipm101", "ipm102", "ipm103", "ipm104",
|
||||
"ipsy101", "ipsy102", "ipsy103",
|
||||
"irmp101", "irmp102", "irmp103",
|
||||
"lida100", "lida101", "lida102", "lida103", "lida104",
|
||||
"lida103fr",
|
||||
"llwd100", "llwd101",
|
||||
"maec101", "maec102", "maec103",
|
||||
"miec101", "miec102", "miec103",
|
||||
"nzext100","nzext101","nzext102","nzext103","nzext104","nzext105","nzext106",
|
||||
"ocl4ed",
|
||||
"oer4covid",
|
||||
"oerf-test",
|
||||
"oeru", "oeru16", "oeru17", "oeru18", "oeru19",
|
||||
"oerudemo",
|
||||
"oeruesp1", "oerupsy110", "oerupsy111",
|
||||
"pibf201", "pibf202", "pibf203",
|
||||
"pman101", "pman102", "pman103",
|
||||
"pmkt101", "pmkt102", "pmkt103",
|
||||
"rrap101", "rrap102", "rrap103", "rrap104",
|
||||
"seda301", "seda302", "seda303",
|
||||
"sp4ed",
|
||||
"uowhumanrights",
|
||||
"uowmun", "uowresm", "uowunggd", "uowunggd",
|
||||
"wacc101", "wacc102", "wacc201", "wacc301",
|
||||
"wenotes",
|
||||
"whme101", "whme102", "whme103",
|
||||
"wikieducator"],
|
||||
"tagsblacklist": ["asiangirl", "japanesa", "panties", "nipples", "stockings",
|
||||
"oppai", "tits", "bigtits", "japanav", "gangbang", "blowjob", "pantsu",
|
||||
"buenosaires", "escuelacuzque", "milf", "lingerie", "ass", "pussy", "josei"],
|
||||
"discourse": {
|
||||
"forums": {
|
||||
"url": "https://forums.oeru.org",
|
||||
"tag_path": "tags",
|
||||
"course_path": "c/courses",
|
||||
"courses": ["ds4oer"]
|
||||
},
|
||||
"community": {
|
||||
"url": "https://community.oeru.org"
|
||||
}
|
||||
}
|
||||
}
|
BIN
static/favicon.png
Normal file
BIN
static/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
13
svelte.config.js
Normal file
13
svelte.config.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
/** @type {import('@sveltejs/kit').Config} */
|
||||
|
||||
import json from '@rollup/plugin-json';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
|
||||
const config = {
|
||||
kit: {
|
||||
// hydrate the <div id="svelte"> element in src/app.html
|
||||
target: '#svelte'
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
4
tailwind.config.cjs
Normal file
4
tailwind.config.cjs
Normal file
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
mode: 'jit',
|
||||
purge: ['./src/**/*.svelte'],
|
||||
}
|
Loading…
Reference in a new issue