Merged in feature/npm-node-upgrade (pull request #350)

Feature/npm node upgrade

* Upgrade npm dependencies, node20, remove Storybook

* Upgrade more libs


Approved-by: Christian Cueni
This commit is contained in:
Daniel Egger 2024-07-12 08:44:14 +00:00
parent 07a0d67a09
commit 12476740df
78 changed files with 6963 additions and 20490 deletions

View File

@ -1,2 +1,2 @@
nodejs 16.17.0
nodejs 20.15.0
python 3.10.6

View File

@ -1,5 +1,5 @@
# this test is based on the docker image described in env/bitbucket/Dockerfile
image: iterativ/vbv-lernwelt-bitbucket
image: iterativ/vbv-lernwelt-bitbucket-node20
## job definitions
e2e: &e2e

View File

@ -10,7 +10,6 @@ module.exports = {
"plugin:vue/vue3-recommended",
"@vue/eslint-config-typescript/recommended",
"@vue/eslint-config-prettier",
"plugin:storybook/recommended",
],
env: {
"vue/setup-compiler-macros": true,
@ -20,8 +19,6 @@ module.exports = {
"tailwind.config.js",
"postcss.config.js",
"src/gql/**/*.ts",
"src/stories/**/*",
"src/**/*.stories.ts",
],
rules: {
"@typescript-eslint/ban-ts-comment": "warn",
@ -29,6 +26,8 @@ module.exports = {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-this-alias": "error",
"vue/require-toggle-inside-transition": "warn",
"vue/no-deprecated-filter": "warn",
"vue/no-v-html": "error",
"vue/no-required-prop-with-default": "error",
},

View File

@ -2,8 +2,10 @@
"htmlWhitespaceSensitivity": "ignore",
"jsonRecursiveSort": true,
"organizeImportsSkipDestructiveCodeActions": true,
"plugins": ["prettier-plugin-sort-json", "prettier-plugin-tailwindcss"],
"printWidth": 88,
"semi": true,
"singleQuote": false,
"tabWidth": 2
"tabWidth": 2,
"trailingComma": "es5"
}

View File

@ -1,30 +0,0 @@
import type { StorybookConfig } from "@storybook/vue3-vite";
import * as path from "path";
import * as initialize from "storybook-tailwind-foundations/initialize.js";
const tailwindConfigPath = path.join(__dirname, "../tailwind.config.js"); // or your own config file
initialize.default.default(tailwindConfigPath);
const config: StorybookConfig = {
stories: [
"../src/**/*.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)",
"../node_modules/storybook-tailwind-foundations/**/*.stories.js",
],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/addon-a11y",
"storybook-addon-designs",
],
framework: {
name: "@storybook/vue3-vite",
options: {},
},
staticDirs: [{ from: "../../server/vbv_lernwelt/static/icons", to: "/static/icons" }],
docs: {
autodocs: "tag",
},
};
export default config;

View File

@ -1,5 +0,0 @@
<style>
a[title="myVBV"] {
background-color: #00224d;
}
</style>

View File

@ -1,6 +0,0 @@
import { addons } from "@storybook/manager-api";
import myvbvTheme from "./myvbvTheme";
addons.setConfig({
theme: myvbvTheme,
});

View File

@ -1,108 +0,0 @@
import { vueRouter } from "storybook-vue3-router";
import { makeDecorator } from "@storybook/addons";
import type { StoryContext, StoryFn } from "@storybook/types";
import {
createRouter,
createWebHashHistory,
type NavigationGuard,
type RouteLocationNormalizedLoaded,
/* types */
type Router,
type RouterOptions,
} from "vue-router";
import { action } from "@storybook/addon-actions";
import type { RouteRecordRaw } from "vue-router";
type MockRouter = Router & { isMocked?: boolean };
type MockRoute = RouteLocationNormalizedLoaded & { isMocked?: boolean };
const Home = {
template: `
<div>
<h2>Home</h2>
<div style="display: flex; gap: 1em">
<router-link to="/">Home</router-link>
<router-link to="/about">About</router-link>
</div>
</div>
`,
};
const About = {
template: `
<div>
<h2>About</h2>
<div style="display: flex; gap: 1em">
<router-link to="/">Home</router-link>
<router-link to="/about">About</router-link>
</div>
</div>
`,
};
const defaultRoutes: RouteRecordRaw[] = [
{
path: "/",
name: "home",
component: Home,
beforeEnter: (to, from) =>
action("beforeEnter")({ to: to.fullPath, from: from.fullPath }),
},
{
path: "/about",
name: "about",
component: About,
beforeEnter: (to, from) =>
action("beforeEnter")({ to: to.fullPath, from: from.fullPath }),
},
];
export const withVueRouter = (
app,
/* optional: routes param - uses `defaultRoutes` if not provided */
routes = defaultRoutes,
/* optional: router options - used to pass `initialRoute` value, `beforeEach()` navigation guard methods and vue-router `createRouter` options */
options?: {
initialRoute?: string;
beforeEach?: NavigationGuard;
vueRouterOptions?: RouterOptions;
}
) => {
/* setup router var */
let router;
/* check if there is an existing router */
const existingRouter = app.config.globalProperties.$router as MockRouter;
const existingRoute = app.config.globalProperties.$route as MockRoute;
if (
(!existingRouter || existingRouter.isMocked === true) &&
(!existingRoute || existingRoute.isMocked === true)
) {
/* create vue router */
router = createRouter({
history: createWebHashHistory(),
routes,
...options?.vueRouterOptions,
});
/* setup optional global router guards */
// globalRouterGuardFn(router, options?.beforeEach)
/* tell storybook to use vue router */
app.use(router);
} else {
/* set router to value of existing router */
// router = existingRouter
// /* reset routes (remove old / add new) */
// resetRoutes(router, routes)
// /* setup optional global router guards (if provided and there is an existing router this will force a page reload) */
// globalRouterGuardFn(existingRouter, options?.beforeEach, true)
// }
// /* go to initial route */
// initialRoute(router, options?.initialRoute)
}
};

View File

@ -1,10 +0,0 @@
import { create } from "@storybook/theming/create";
import logo from "./vbv-logo.svg";
export default create({
base: "light",
brandTitle: "myVBV",
brandUrl: "https://myvbv.iterativ.ch",
brandImage: logo,
brandTarget: "_self",
});

View File

@ -1,10 +0,0 @@
<script>
window.global = window;
</script>
<script defer src="https://myvbv.iterativ.ch/server/core/icons/"></script>
<link
href="https://myvbv.iterativ.ch/static/fonts/BuenosAires/stylesheet.css"
rel="stylesheet"
/>

View File

@ -1,21 +0,0 @@
import { Preview, setup } from "@storybook/vue3";
import "../tailwind.css";
import { withVueRouter } from "./mockRouter";
setup((app) => {
withVueRouter(app);
});
const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};
export default preview;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" x="0px"
y="0px"
viewBox="0 0 450.709 418.11" enable-background="new 0 0 450.709 418.11" xml:space="preserve">
<g>
<g>
<path fill="#FFFFFF" d="M262.573,231.338c-8.74-7.379-17.496-10.559-28.81-10.559c-23.314,0-38.378,16.943-38.378,43.168v67.706
c0,1.566,1.269,2.835,2.835,2.835h11.603c1.566,0,2.835-1.269,2.835-2.835v-40.89h33.462c1.566,0,2.835-1.269,2.835-2.835v-10.34
c0-1.566-1.269-2.835-2.835-2.835h-33.462v-11.31c0-17.186,7.677-26.653,21.612-26.653c7.148,0,12.845,2.163,18.155,6.957
c0.069,0.063,0.586,0.523,1.2,1.07c1.228,1.093,3.126,0.917,4.13-0.385l6.31-8.181c0.888-1.151,0.76-2.788-0.295-3.789
C263.175,231.899,262.648,231.401,262.573,231.338z"/>
</g>
<g>
<path fill="#FFFFFF" d="M225.62,125.182c0.003-1.573,1.289-2.843,2.863-2.829c0.675,0.006,1.231,0.014,1.333,0.024
c6.856,0.657,13.394,3.223,18.955,7.448c9.876,7.504,15.388,19.34,14.743,31.662c-1.041,19.793-17.869,35.296-38.312,35.296
h-26.977c-1.566,0-2.835-1.269-2.835-2.835V86.457c0-1.566,1.269-2.835,2.835-2.835h11.585c1.566,0,2.835,1.269,2.835,2.835
v91.169c0,1.566,1.269,2.835,2.835,2.835h10.081c11.139,0,20.622-8.355,21.591-19.019c1.042-11.523-7.505-21.809-19.019-22.824
c-1.445-0.127-2.537-1.369-2.534-2.82L225.62,125.182z"/>
</g>
</g>
<g>
<path fill="#0069B0" d="M351.43,291.772"/>
<path fill="#0079C3" d="M366.594,287.348c1.275,1.882-0.074,4.424-2.347,4.424h0.012H351.79c-0.941,0-1.82-0.467-2.347-1.245
l-29.151-43.055l-29.151,43.055c-0.527,0.779-1.406,1.245-2.347,1.245h-12.47c-2.273,0-3.622-2.542-2.347-4.424l43.967-64.92
c1.124-1.66,3.57-1.66,4.694,0L366.594,287.348z"/>
<path fill="#FFFFFF" d="M176.731,287.348c1.275,1.882-0.074,4.424-2.347,4.424h0.012h-12.469c-0.941,0-1.82-0.467-2.347-1.245
l-29.151-43.055l-29.151,43.055c-0.527,0.779-1.406,1.245-2.347,1.245h-12.47c-2.273,0-3.622-2.542-2.347-4.424l43.967-64.92
c1.124-1.66,3.57-1.66,4.694,0L176.731,287.348z"/>
<path fill="#0079C3" d="M84.114,132.238c-1.275-1.882,0.074-4.424,2.347-4.424h-0.012h12.469c0.941,0,1.82,0.467,2.347,1.245
l29.151,43.055l29.151-43.055c0.527-0.779,1.406-1.245,2.347-1.245h12.47c2.273,0,3.622,2.542,2.347,4.424l-43.967,64.92
c-1.124,1.66-3.57,1.66-4.694,0L84.114,132.238z"/>
<path fill="#FFFFFF" d="M273.978,132.238c-1.275-1.882,0.074-4.424,2.347-4.424h-0.012h12.469c0.941,0,1.82,0.467,2.347,1.245
l29.151,43.055l29.151-43.055c0.527-0.779,1.406-1.245,2.347-1.245h12.47c2.273,0,3.622,2.542,2.347,4.424l-43.967,64.92
c-1.124,1.66-3.57,1.66-4.694,0L273.978,132.238z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />

24802
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,7 @@
"name": "client",
"version": "0.0.0",
"scripts": {
"build": "npm run typecheck && vite build && node versionize && cp ./dist/index.html ../server/vbv_lernwelt/templates/vue/index.html && rm -rf ../server/vbv_lernwelt/static/vue/* && cp -r ./dist/static/vue ../server/vbv_lernwelt/static/ && npm run build-storybook",
"build-storybook": "rm -rf ../server/vbv_lernwelt/static/storybook/* && storybook build -o ../server/vbv_lernwelt/static/storybook",
"build": "npm run typecheck && vite build && node versionize && cp ./dist/index.html ../server/vbv_lernwelt/templates/vue/index.html && rm -rf ../server/vbv_lernwelt/static/vue/* && cp -r ./dist/static/vue ../server/vbv_lernwelt/static/",
"build:tailwind": "tailwindcss -i tailwind.css -o ../server/vbv_lernwelt/static/css/tailwind.css --minify",
"codegen": "graphql-codegen && node minimizeGraphqlSchema.mjs",
"codegen:watch": "graphql-codegen --watch",
@ -13,97 +12,78 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"prettier": "prettier . --write",
"prettier:check": "prettier . --check",
"storybook": "storybook dev -p 6006",
"tailwind": "tailwindcss -i tailwind.css -o ../server/vbv_lernwelt/static/css/tailwind.css --watch",
"test": "vitest run",
"typecheck": "npm run codegen && vue-tsc --noEmit -p tsconfig.app.json --composite false",
"typecheck-only": "vue-tsc --noEmit -p tsconfig.app.json --composite false"
},
"dependencies": {
"@headlessui/tailwindcss": "^0.2.0",
"@headlessui/vue": "^1.7.20",
"@sentry/tracing": "^7.56.0",
"@sentry/vue": "^7.56.0",
"@urql/exchange-graphcache": "^6.3.2",
"@urql/introspection": "^1.0.2",
"@urql/vue": "^1.1.2",
"@headlessui/tailwindcss": "^0.2.1",
"@headlessui/vue": "^1.7.22",
"@sentry/tracing": "^7.114.0",
"@sentry/vue": "^8.17.0",
"@urql/exchange-graphcache": "^7.1.2",
"@urql/introspection": "^1.1.0",
"@urql/vue": "^1.3.2",
"@vuepic/vue-datepicker": "^8.8.1",
"@vueuse/core": "^10.9.0",
"@vueuse/router": "^10.9.0",
"@vueuse/core": "^10.11.0",
"@vueuse/router": "^10.11.0",
"cypress": "^12.14.0",
"d3": "^7.8.5",
"dayjs": "^1.11.8",
"graphql": "^16.6.0",
"i18next": "^23.2.8",
"i18next-locize-backend": "^6.2.2",
"i18next-vue": "^2.2.0",
"locize": "^2.4.6",
"d3": "^7.9.0",
"dayjs": "^1.11.11",
"graphql": "^16.9.0",
"i18next": "^23.11.5",
"i18next-locize-backend": "^6.4.3",
"i18next-vue": "^4.0.0",
"locize": "^3.3.0",
"lodash": "^4.17.21",
"loglevel": "^1.8.0",
"mitt": "^3.0.0",
"pinia": "^2.1.4",
"vue": "^3.3.4",
"vue-router": "^4.2.2"
"loglevel": "^1.9.1",
"mitt": "^3.0.1",
"pinia": "^2.1.7",
"vue": "^3.4.31",
"vue-router": "^4.4.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^4.0.1",
"@graphql-codegen/client-preset": "^4.0.1",
"@rollup/plugin-alias": "^4.0.3",
"@rushstack/eslint-patch": "^1.1.4",
"@savvywombat/tailwindcss-grid-areas": "^3.0.0",
"@storybook/addon-a11y": "^7.0.22",
"@storybook/addon-essentials": "^7.0.22",
"@storybook/addon-interactions": "^7.0.22",
"@storybook/addon-links": "^7.0.22",
"@storybook/addons": "^7.0.22",
"@storybook/blocks": "^7.0.22",
"@storybook/manager-api": "^7.0.22",
"@storybook/testing-library": "^0.1.0",
"@storybook/theming": "^7.0.22",
"@storybook/vue3": "^7.0.22",
"@storybook/vue3-vite": "^7.0.22",
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/typography": "^0.5.4",
"@testing-library/vue": "^7.0.0",
"@types/d3": "^7.4.0",
"@types/jsdom": "^21.1.1",
"@types/lodash": "^4.14.195",
"@types/node": "^18.16.18",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^11.0.0",
"@vue/test-utils": "^2.0.2",
"@vue/tsconfig": "^0.1.3",
"autoprefixer": "^10.4.8",
"concurrently": "^8.0.1",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-storybook": "^0.6.12",
"eslint-plugin-vue": "^9.15.0",
"jsdom": "^22.1.0",
"locize-cli": "^7.14.6",
"postcss": "^8.4.14",
"postcss-import": "^15.1.0",
"prettier": "^2.8.8",
"prettier-plugin-organize-imports": "^3.1.1",
"prettier-plugin-sort-json": "^1.0.0",
"prettier-plugin-tailwindcss": "^0.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"replace-in-file": "^6.3.5",
"sass": "^1.63.4",
"sass-loader": "^13.3.2",
"start-server-and-test": "^2.0.0",
"storybook": "^7.0.22",
"storybook-addon-designs": "^v7.0.0-beta.2",
"storybook-tailwind-foundations": "^1.1.2",
"storybook-vue3-router": "^3.0.0-next.1",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.3",
"vite": "^4.3.9",
"vitest": "^0.32.2",
"vue-eslint-parser": "^9.2.1",
"vue-tsc": "^1.8.1"
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.3.2",
"@rushstack/eslint-patch": "^1.8.0",
"@savvywombat/tailwindcss-grid-areas": "^4.0.0",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.13",
"@testing-library/vue": "^8.1.0",
"@tsconfig/node20": "^20.1.4",
"@types/d3": "^7.4.3",
"@types/jsdom": "^21.1.7",
"@types/lodash": "^4.17.6",
"@types/node": "^20.14.10",
"@vitejs/plugin-vue": "^5.0.5",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.5.1",
"autoprefixer": "^10.4.19",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-cypress": "^2.15.2",
"eslint-plugin-vue": "^9.27.0",
"jsdom": "^24.1.0",
"locize-cli": "^8.0.1",
"postcss": "^8.4.39",
"postcss-import": "^16.1.0",
"prettier": "^3.3.2",
"prettier-plugin-organize-imports": "^4.0.0",
"prettier-plugin-sort-json": "^4.0.0",
"prettier-plugin-tailwindcss": "^0.6.5",
"replace-in-file": "^7.2.0",
"sass": "^1.77.7",
"sass-loader": "^14.2.1",
"start-server-and-test": "^2.0.4",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.3",
"vite": "^4.5.3",
"vitest": "^2.0.2",
"vue-eslint-parser": "^9.4.3",
"vue-tsc": "^2.0.26"
}
}

View File

@ -4,6 +4,7 @@ import type {
CourseSession,
LearningContent,
LearningContentAssignment,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
LearningContentEdoniqTest,
} from "@/types";
import log from "loglevel";
@ -89,7 +90,7 @@ const isEdoniqTest = (lc: LearningContent) => {
const getLearningContentType = (lc: LearningContent) => {
if (isAssignment(lc)) {
const lcTypeData = learningContentTypeData(lc);
const lcTypeData = learningContentTypeData(lc, t);
if ((lc as LearningContentAssignment).assignment_type === "REFLECTION") {
return lcTypeData.title;
}
@ -183,7 +184,9 @@ const getIconName = (lc: LearningContent) => {
<AssignmentSubmissionProgress
v-if="isAssignment(submittable.content) || isEdoniqTest(submittable.content)"
:course-session="props.courseSession"
:learning-content="submittable.content as (LearningContentAssignment | LearningContentEdoniqTest)"
:learning-content="
submittable.content as LearningContentAssignment | LearningContentEdoniqTest
"
:show-title="false"
class="grow pr-8"
/>

View File

@ -1,57 +0,0 @@
// @ts-nocheck
import avatar from "../../../.storybook/uk1.patrizia.huggel.jpg";
import AccountMenuContent from "@/components/header/AccountMenuContent.vue";
import type { Meta, StoryObj } from "@storybook/vue3";
// More on how to set up stories at: https://storybook.js.org/docs/7.0/vue/writing-stories/introduction
const meta: Meta<typeof AccountMenuContent> = {
title: "VBV/Header/AccountMenuContent",
component: AccountMenuContent,
tags: ["autodocs"],
argTypes: { onClosemodal: { action: "closeModal" } },
parameters: {
viewport: {
defaultViewport: "mobile1",
},
},
decorators: [() => ({ template: '<div class=""><story /></div>' })],
};
export default meta;
type Story = StoryObj<typeof AccountMenuContent>;
const courseSessions = [
{
id: "1",
title: "Bern 2023 a",
},
{
id: "2",
title: "Zürich 2023 a",
},
];
const loggedInUser = {
first_name: "Vreni",
last_name: "Schmid",
email: "vreni.schmid@example.com",
avatar_url: avatar,
loggedIn: true,
};
export const LoggedInUser: Story = {
args: {
allCourseSessions: courseSessions,
user: loggedInUser,
},
};
export const NoUser: Story = {
args: {
allCourseSessions: courseSessions,
user: {
loggedIn: false,
},
},
};

View File

@ -1,37 +0,0 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import type { Item } from "./CourseSessionsMenu.vue";
import CourseSessionsMenu from "./CourseSessionsMenu.vue";
const meta: Meta<typeof CourseSessionsMenu> = {
title: "VBV/CourseSessionsMenu",
component: CourseSessionsMenu,
};
export default meta;
type Story = StoryObj<typeof CourseSessionsMenu>;
const items: Item[] = [
{
id: "1",
title: "Bern 2021 a",
},
{
id: "2",
title: "Bern 2021 b",
},
{
id: "3",
title: "Bern 2022 a",
},
{
id: "4",
title: "Bern 2022 b",
},
];
export const CourseSessionsMenuStory: Story = {
args: {
// @ts-ignore
items,
},
};

View File

@ -1,64 +0,0 @@
// @ts-nocheck
import avatar from "../../../.storybook/uk1.patrizia.huggel.jpg";
import type { Meta, StoryObj } from "@storybook/vue3";
import MobileMenu from "./MobileMenu.vue";
// More on how to set up stories at: https://storybook.js.org/docs/7.0/vue/writing-stories/introduction
const meta: Meta<typeof MobileMenu> = {
title: "VBV/Header/MobileMenu",
component: MobileMenu,
tags: ["autodocs"],
argTypes: { onClosemodal: { action: "closeModal" } },
parameters: {
viewport: {
defaultViewport: "mobile1",
},
},
decorators: [() => ({ template: '<div class="-ml-4 lg:-ml-16"><story /></div>' })],
};
export default meta;
type Story = StoryObj<typeof MobileMenu>;
export const MobileMenuLoggedOut: Story = {
args: {
show: true,
courseSession: undefined,
mediaUrl: undefined,
},
};
export const MobileMenuLoggedInInCourse: Story = {
args: {
show: true,
courseSession: {
course: {
title: "Test Course",
},
course_url: "https://www.vbv.ch",
learning_path_url: "https://www.vbv.ch",
},
user: {
first_name: "Vreni",
last_name: "Schmid",
avatar_url: avatar,
loggedIn: true,
},
mediaUrl: "https://www.vbv.ch",
},
};
export const MobileMenuLoggedInDashboard: Story = {
args: {
show: true,
courseSession: undefined,
user: {
first_name: "Vreni",
last_name: "Schmid",
avatar_url: avatar,
loggedIn: true,
},
mediaUrl: "https://www.vbv.ch",
},
};

View File

@ -11,7 +11,7 @@ import { PopoverButton } from "@headlessui/vue";
<NotificationList :num-notifications-to-show="4" />
<router-link to="/notifications">
<PopoverButton
class="btn-text inline-flex inline-flex items-center text-blue-900"
class="btn-text inline-flex items-center text-blue-900"
data-cy="show-all-notifications"
>
<span>{{ $t("general.showAll") }}</span>

View File

@ -1,60 +0,0 @@
// @ts-nocheck
import ItButton from "@/components/ui/ItButton.vue";
import type { Meta, StoryObj } from "@storybook/vue3";
const meta: Meta<typeof ItButton> = {
title: "VBV/Button",
component: ItButton,
tags: ["autodocs"],
render: (args) => ({
components: { ItButton },
setup() {
return { args };
},
template: '<ItButton v-bind="args" v-html="args.label"></ItButton>',
}),
parameters: {
design: {
type: "figma",
url: "https://www.figma.com/file/Svqt2dNY0cF4FCyyiWmitN/vbv-storybook-library?node-id=1-2&t=3AfFOE3SqBxniETT-4",
},
},
argTypes: {
variant: {
options: ["primary", "secondary", "blue", "text"],
control: { type: "select" },
},
size: {
options: ["normal", "large"],
control: { type: "radio" },
},
},
};
export default meta;
type Story = StoryObj<typeof ItButton>;
export const TextButton: Story = {
args: {
label: "Hello world",
},
};
export const ImageLeftButton: Story = {
args: {
label: '<it-icon-message class="-ml-1 mr-3 h-5 w-5"></it-icon-message> Hello world',
},
};
export const ImageRightButton: Story = {
args: {
label: 'Hello world <it-icon-message class="ml-3 -mr-1 h-5 w-5"></it-icon-message>',
},
};
export const ImageLargeRightButton: Story = {
args: {
size: "large",
label: 'Hello world <it-icon-message class="ml-3 -mr-1 h-6 w-6"></it-icon-message>',
},
};

View File

@ -1,40 +0,0 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import ItCheckboxGroup from "./ItCheckboxGroup.vue";
// More on how to set up stories at: https://storybook.js.org/docs/7.0/vue/writing-stories/introduction
const meta: Meta<typeof ItCheckboxGroup> = {
title: "VBV/CheckboxGroup",
component: ItCheckboxGroup,
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/vue/writing-docs/docs-page
tags: ["autodocs"],
args: { label: "A Label" }, // default value
argTypes: { "onUpdate:items": { action: "itemsUpdate" } },
};
export default meta;
type Story = StoryObj<typeof ItCheckboxGroup>;
export const CheckboxGroup: Story = {
args: {
label: "Label",
items: [
{
value: "checkbox1",
label: "Label 1",
subtitle: "Subtitle 1",
checked: false,
},
{
value: "checkbox2",
label: "Label 2",
subtitle: "Subtitle 2",
checked: false,
},
{
value: "checkbox3",
label: "Label 3",
checked: false,
},
],
},
};

View File

@ -1,29 +0,0 @@
import ItNavigationProgress from "@/components/ui/ItNavigationProgress.vue";
import type { Meta, StoryObj } from "@storybook/vue3";
// More on how to set up stories at: https://storybook.js.org/docs/7.0/vue/writing-stories/introduction
const meta: Meta<typeof ItNavigationProgress> = {
title: "VBV/NavigationProgress",
component: ItNavigationProgress,
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/vue/writing-docs/docs-page
tags: ["autodocs"],
};
export default meta;
type Story = StoryObj<typeof ItNavigationProgress>;
export const NavigationProgressPartial: Story = {
args: {
steps: 5,
currentStep: 3,
startBadgeText: "Einleitung",
endBadgeText: "Abgabe",
},
};
export const NavigationProgressNoStartEndBadge: Story = {
args: {
steps: 5,
currentStep: 3,
},
};

View File

@ -1,45 +0,0 @@
// ButtonGroup.stories.ts
import type { Meta, StoryObj } from "@storybook/vue3";
import ItProgress from "./ItProgress.vue";
// More on how to set up stories at: https://storybook.js.org/docs/7.0/vue/writing-stories/introduction
const meta: Meta<typeof ItProgress> = {
title: "VBV/ProgressBar",
component: ItProgress,
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/vue/writing-docs/docs-page
tags: ["autodocs"],
};
export default meta;
type Story = StoryObj<typeof ItProgress>;
export const NoProgress: Story = {
args: {
statusCount: {
FAIL: 0,
SUCCESS: 0,
UNKNOWN: 10,
},
},
};
export const FiftyPrecentSuccessProgress: Story = {
args: {
statusCount: {
FAIL: 0,
SUCCESS: 5,
UNKNOWN: 5,
},
},
};
export const FiftyPrecentFailProgress: Story = {
args: {
statusCount: {
FAIL: 5,
SUCCESS: 0,
UNKNOWN: 5,
},
},
};

View File

@ -1,35 +0,0 @@
import type { RadioItem } from "@/pages/learningPath/learningContentPage/feedback/feedback.types";
import type { Meta, StoryObj } from "@storybook/vue3";
import ItRadioGroup from "./ItRadioGroup.vue";
const meta: Meta<typeof ItRadioGroup> = {
title: "VBV/RadioGroup",
component: ItRadioGroup,
argTypes: { "onUpdate:modelValue": { action: "updated" } },
};
export default meta;
type Story = StoryObj<typeof ItRadioGroup>;
let modelValue = "a";
const items: RadioItem<string>[] = [
{
value: "a",
name: "A",
},
{
value: "b",
name: "B",
},
];
export const RadioGroup: Story = {
args: {
modelValue: modelValue,
items: items,
label: "Radiogroup",
"onUpdate:modelValue": (newValue: any) => {
modelValue = newValue;
},
},
};

View File

@ -1,7 +1,7 @@
<template>
<RadioGroup
:model-value="modelValue"
@update:modelValue="$emit('update:modelValue', $event)"
@update:model-value="$emit('update:modelValue', $event)"
>
<RadioGroupLabel class="heading-1 mb-8 block">
{{ label }}

View File

@ -1,19 +0,0 @@
import ItSuccessAlert from "@/components/ui/ItSuccessAlert.vue";
import type { Meta, StoryObj } from "@storybook/vue3";
// More on how to set up stories at: https://storybook.js.org/docs/7.0/vue/writing-stories/introduction
const meta: Meta<typeof ItSuccessAlert> = {
title: "VBV/SuccessAlert",
component: ItSuccessAlert,
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/vue/writing-docs/docs-page
tags: ["autodocs"],
};
export default meta;
type Story = StoryObj<typeof ItSuccessAlert>;
export const Default: Story = {
args: {
text: "Deiner Praxisauftrag wurde abgegeben",
},
};

View File

@ -1,29 +0,0 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import RatingScale from "./RatingScale.vue";
// More on how to set up stories at: https://storybook.js.org/docs/7.0/vue/writing-stories/introduction
const meta: Meta<typeof RatingScale> = {
title: "VBV/RatingScale",
component: RatingScale,
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/vue/writing-docs/docs-page
tags: ["autodocs"],
};
export default meta;
type Story = StoryObj<typeof RatingScale>;
export const RatingScaleGreen: Story = {
args: {
ratings: [3, 4, 3, 4],
title: "Frage 3",
text: "Wie zufrieden bist du mit dem Kurs “Überbetriebliche Kurse” im Allgemeinen?",
},
};
export const RatingScaleOrange: Story = {
args: {
ratings: [2, 1, 2, 3],
title: "Frage 5",
text: "Wie zufrieden bist du mit dem Kurs “Überbetriebliche Kurse” im Allgemeinen?",
},
};

View File

@ -1,29 +0,0 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import VerticalBarChart from "./VerticalBarChart.vue";
// More on how to set up stories at: https://storybook.js.org/docs/7.0/vue/writing-stories/introduction
const meta: Meta<typeof VerticalBarChart> = {
title: "VBV/VerticalBarChart",
component: VerticalBarChart,
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/vue/writing-docs/docs-page
tags: ["autodocs"],
};
export default meta;
type Story = StoryObj<typeof VerticalBarChart>;
export const VerticalBarChartOneThirdYes: Story = {
args: {
title: "Frage X",
text: "Fragentext",
ratings: [true, true, false, true, true, false, true, false],
},
};
export const VerticalBarChartAllFalse: Story = {
args: {
title: "Frage Y",
text: "Das ist ein anderer Fragetext",
ratings: [false, false, false, false, false, false, false, false],
},
};

View File

@ -1,3 +1,4 @@
/* eslint-disable */
import type { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
import type { FragmentDefinitionNode } from 'graphql';
import type { Incremental } from './graphql';
@ -19,25 +20,45 @@ export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
): TType;
// return nullable if `fragmentType` is undefined
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined
): TType | undefined;
// return nullable if `fragmentType` is nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null
): TType | null;
// return nullable if `fragmentType` is nullable or undefined
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
): TType | null | undefined;
// return array of non-nullable if `fragmentType` is array of non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>
): Array<TType>;
// return array of nullable if `fragmentType` is array of nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
): Array<TType> | null | undefined;
// return readonly array of non-nullable if `fragmentType` is array of non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
): ReadonlyArray<TType>;
// return array of nullable if `fragmentType` is array of nullable
// return readonly array of nullable if `fragmentType` is array of nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
): ReadonlyArray<TType> | null | undefined;
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
): TType | ReadonlyArray<TType> | null | undefined {
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | Array<FragmentType<DocumentTypeDecoration<TType, any>>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
return fragmentType as any;
}

View File

@ -10,6 +10,7 @@ import { computed, onMounted } from "vue";
import { useRouter } from "vue-router";
import { getPreviousRoute } from "@/router/history";
import { getAssignmentTypeTitle } from "../../utils/utils";
import { useTranslation } from "i18next-vue";
const props = defineProps<{
courseSlug: string;
@ -21,6 +22,7 @@ log.debug("AssignmentEvaluationPage created", props.assignmentId, props.userId);
const courseSession = useCurrentCourseSession();
const router = useRouter();
const { t } = useTranslation();
// noinspection TypeScriptValidateTypes TODO: because of IntelliJ
const queryResult = useQuery({
@ -80,7 +82,7 @@ const assignment = computed(
<it-icon-assignment class="h-6 w-6"></it-icon-assignment>
<div class="ml-2">
<span v-if="assignment">
{{ getAssignmentTypeTitle(assignment.assignment_type) }}:
{{ getAssignmentTypeTitle(assignment.assignment_type, t) }}:
</span>
{{ assignment?.title }}
</div>

View File

@ -41,6 +41,7 @@ const learningContentAssignment = computed(() => {
</nav>
<main>
<div class="bg-white p-6">
<!-- prettier-ignore -->
<AssignmentDetails
v-if="learningContentAssignment"
:course-session="courseSession"

View File

@ -46,7 +46,7 @@ const presenceCoursesDropdownOptions = computed(() => {
name: `${t("Präsenzkurs")} ${
attendanceCourse.learning_content.circle?.title
} ${dayjs(attendanceCourse.due_date?.start).format("DD.MM.YYYY")}`,
} as DropdownSelectable)
}) as DropdownSelectable
);
});
@ -229,9 +229,9 @@ watch(
<ItCheckbox
:disabled="state.attendanceSaved"
:checkbox-item="{
value: true,
checked: state.userPresence.get(csu.user_id) as boolean,
}"
value: true,
checked: state.userPresence.get(csu.user_id) as boolean,
}"
@toggle="
state.userPresence.set(
csu.user_id,

View File

@ -76,7 +76,7 @@ async function exportData() {
<template #default="{ item }">
<div
class="flex justify-between"
:data-cy=" (item as AssignmentStatisticsRecordType).assignment_title"
:data-cy="(item as AssignmentStatisticsRecordType).assignment_title"
>
<div>
<h4 class="font-bold">
@ -98,7 +98,9 @@ async function exportData() {
</div>
<div class="w-72">
<div
v-if="(item as AssignmentStatisticsRecordType).metrics.ranking_completed"
v-if="
(item as AssignmentStatisticsRecordType).metrics.ranking_completed
"
>
{{ (item as AssignmentStatisticsRecordType).metrics.passed_count }} von
{{ total((item as AssignmentStatisticsRecordType).metrics) }}
@ -107,8 +109,8 @@ async function exportData() {
<div v-else>Noch nicht bestätigt</div>
<ItProgress
:status-count="
assignmentStats((item as AssignmentStatisticsRecordType).metrics)
"
assignmentStats((item as AssignmentStatisticsRecordType).metrics)
"
></ItProgress>
<router-link
class="underline"

View File

@ -95,7 +95,10 @@ async function exportData() {
</div>
<ItProgress
:status-count="
attendanceStats((item as PresenceRecordStatisticsType).participants_present, (item as PresenceRecordStatisticsType).participants_total)
attendanceStats(
(item as PresenceRecordStatisticsType).participants_present,
(item as PresenceRecordStatisticsType).participants_total
)
"
></ItProgress>
<router-link

View File

@ -67,7 +67,11 @@ async function exportData() {
<div class="mb-4 flex items-center space-x-2">
<div
class="rounded px-2 py-1"
:style="{ backgroundColor: getBlendedColorForRating((item as FeedbackStatisticsRecordType).satisfaction_average) }"
:style="{
backgroundColor: getBlendedColorForRating(
(item as FeedbackStatisticsRecordType).satisfaction_average
),
}"
>
<i18next :translation="$t('a.{AVG} von {MAX}')">
<template #AVG>

View File

@ -13,11 +13,11 @@ const props = defineProps<{
class="flex h-min w-min items-center gap-2 rounded-full bg-gray-200 px-2.5 py-0.5"
>
<component
:is="learningContentTypeData(props.learningContent).icon"
:is="learningContentTypeData(props.learningContent, $t).icon"
class="h-6 w-6"
></component>
<p class="whitespace-nowrap">
{{ learningContentTypeData(props.learningContent).title }}
{{ learningContentTypeData(props.learningContent, $t).title }}
</p>
</div>
</template>

View File

@ -186,8 +186,14 @@ type LearninContentWithCompetenceCertificate =
}}
<br />
<router-link
v-if="(learningContent as LearninContentWithCompetenceCertificate).competence_certificate?.frontend_url"
:to="(learningContent as LearninContentWithCompetenceCertificate).competence_certificate?.frontend_url ?? ''"
v-if="
(learningContent as LearninContentWithCompetenceCertificate)
.competence_certificate?.frontend_url
"
:to="
(learningContent as LearninContentWithCompetenceCertificate)
.competence_certificate?.frontend_url ?? ''
"
class="link"
data-cy="show-results"
>

View File

@ -176,7 +176,7 @@ const getTitle = () => {
const subTitle = computed(() => {
if (assignment.value) {
const prefix = learningContentTypeData(props.learningContent).title;
const prefix = learningContentTypeData(props.learningContent, t).title;
return `${prefix}: ${assignment.value?.title ?? ""}`;
}
return "";

View File

@ -7,6 +7,7 @@ import type { LearningContent } from "@/types";
import { learningContentTypeData } from "@/utils/typeMaps";
import { computed } from "vue";
import eventBus from "@/utils/eventBus";
import { t } from "i18next";
interface Props {
title?: string;
@ -47,7 +48,7 @@ const subTitle = computed(() => {
return props.subTitle;
}
if (props.learningContent) {
return learningContentTypeData(props.learningContent).title;
return learningContentTypeData(props.learningContent, t).title;
}
return "";
});
@ -57,7 +58,7 @@ const icon = computed(() => {
return props.icon;
}
if (props.learningContent) {
return learningContentTypeData(props.learningContent).icon;
return learningContentTypeData(props.learningContent, t).icon;
}
return "";
});

View File

@ -5,6 +5,7 @@ import type { LearningContent } from "@/types";
import { learningContentTypeData } from "@/utils/typeMaps";
import { computed } from "vue";
import eventBus from "@/utils/eventBus";
import { useTranslation } from "i18next-vue";
export interface Props {
title?: string;
@ -20,12 +21,14 @@ const props = withDefaults(defineProps<Props>(), {
learningContent: undefined,
});
const { t } = useTranslation();
const subTitle = computed(() => {
if (props.subTitle) {
return props.subTitle;
}
if (props.learningContent) {
return learningContentTypeData(props.learningContent).title;
return learningContentTypeData(props.learningContent, t).title;
}
return "";
});
@ -35,7 +38,7 @@ const icon = computed(() => {
return props.icon;
}
if (props.learningContent) {
return learningContentTypeData(props.learningContent).icon;
return learningContentTypeData(props.learningContent, t).icon;
}
return "";
});

View File

@ -1,41 +0,0 @@
import LearningPathCircle from "@/pages/learningPath/learningPathPage/LearningPathCircle.vue";
import type { Meta, StoryObj } from "@storybook/vue3";
//👇 This default export determines where your story goes in the story list
const meta: Meta<typeof LearningPathCircle> = {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/7.0/react/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: "VBV/LearningPath/LearningPathCircle",
component: LearningPathCircle,
tags: ["autodocs"],
decorators: [
() => ({
template:
'<div style="margin: 3em;"><story class="h-24 w-24 snap-center"/></div>',
}),
],
};
export default meta;
type Story = StoryObj<typeof LearningPathCircle>;
export const FirstStory: Story = {
args: {
sectors: [
{
progress: "finished",
},
{
progress: "finished",
},
{
progress: "in_progress",
},
{
progress: "none",
},
],
},
};

View File

@ -26,7 +26,7 @@ const courseData = computed(() => {
}
if (startsWith(props.courseType, "vv")) {
return {
name: getVVCourseName(props.courseType),
name: getVVCourseName(props.courseType, t),
imageUrl: mood_vv,
contactEmail: "vermittler@vbv-afa.ch",
};

View File

@ -243,7 +243,7 @@ const executePayment = async () => {
:translation="$t('a.Der Preis für den Lehrgang {course} beträgt {price}.')"
>
<template #course>
<b>«{{ getVVCourseName(props.courseType) }}»</b>
<b>«{{ getVVCourseName(props.courseType, $t) }}»</b>
</template>
<template #price>
<b class="whitespace-nowrap">300 CHF</b>

View File

@ -1,8 +1,4 @@
import { useTranslation } from "i18next-vue";
export const getVVCourseName = (courseType: string) => {
const { t } = useTranslation();
export const getVVCourseName = (courseType: string, t: (key: string) => string) => {
if (!["vv-de", "vv-it", "vv-fr"].includes(courseType)) {
return "";
}

View File

@ -1,51 +0,0 @@
<template>
<button type="button" :class="classes" :style="style" @click="onClick">
{{ label }}
</button>
</template>
<script lang="ts" setup>
import { computed } from "vue";
import "./button.css";
const props = withDefaults(
defineProps<{
/**
* The label of the button
*/
label: string;
/**
* primary or secondary button
*/
primary?: boolean;
/**
* size of the button
*/
size?: "small" | "medium" | "large";
/**
* background color of the button
*/
backgroundColor?: string;
}>(),
{ primary: false }
);
const emit = defineEmits<{
(e: "click", id: number): void;
}>();
const classes = computed(() => ({
"storybook-button": true,
"storybook-button--primary": props.primary,
"storybook-button--secondary": !props.primary,
[`storybook-button--${props.size || "medium"}`]: true,
}));
const style = computed(() => ({
backgroundColor: props.backgroundColor,
}));
const onClick = () => {
emit("click", 1);
};
</script>

View File

@ -1,42 +0,0 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import MyHeader from "./ExampleHeader.vue";
const meta: Meta<typeof MyHeader> = {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/7.0/vue/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: "Example/Header",
component: MyHeader,
render: (args: any) => ({
components: { MyHeader },
setup() {
return { args };
},
template: '<my-header :user="args.user" />',
}),
parameters: {
// More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
layout: "fullscreen",
},
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/vue/writing-docs/docs-page
tags: ["autodocs"],
};
export default meta;
type Story = StoryObj<typeof MyHeader>;
export const LoggedIn: Story = {
args: {
user: {
name: "Jane Doe",
},
},
};
export const LoggedOut: Story = {
args: {
user: null,
},
};

View File

@ -1,59 +0,0 @@
<template>
<header>
<div class="wrapper">
<div>
<svg
width="32"
height="32"
viewBox="0 0 32 32"
xmlns="http://www.w3.org/2000/svg"
>
<g fill="none" fill-rule="evenodd">
<path
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
fill="#FFF"
/>
<path
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
fill="#555AB9"
/>
<path
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
fill="#91BAF8"
/>
</g>
</svg>
<h1>Acme</h1>
</div>
<div>
<span v-if="user" class="welcome">
Welcome,
<b>{{ user.name }}</b>
!
</span>
<my-button v-if="user" size="small" label="Log out" @click="$emit('logout')" />
<my-button v-if="!user" size="small" label="Log in" @click="$emit('login')" />
<my-button
v-if="!user"
primary
size="small"
label="Sign up"
@click="$emit('createAccount')"
/>
</div>
</div>
</header>
</template>
<script lang="ts" setup>
import MyButton from "./ExampleButton.vue";
import "./header.css";
defineProps<{ user: { name: string } | null }>();
defineEmits<{
(event: "createAccount"): void;
(event: "login"): void;
(event: "logout"): void;
}>();
</script>

View File

@ -1,34 +0,0 @@
import { userEvent, within } from "@storybook/testing-library";
import type { Meta, StoryObj } from "@storybook/vue3";
import MyPage from "./ExamplePage.vue";
const meta: Meta<typeof MyPage> = {
title: "Example/Page",
component: MyPage,
render: () => ({
components: { MyPage },
template: "<my-page />",
}),
parameters: {
// More on how to position stories at: https://storybook.js.org/docs/7.0/vue/configure/story-layout
layout: "fullscreen",
},
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/vue/writing-docs/docs-page
tags: ["autodocs"],
};
export default meta;
type Story = StoryObj<typeof MyPage>;
// More on interaction testing: https://storybook.js.org/docs/7.0/vue/writing-tests/interaction-testing
export const LoggedIn: Story = {
play: async ({ canvasElement }: any) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole("button", {
name: /Log in/i,
});
await userEvent.click(loginButton);
},
};
export const LoggedOut: Story = {};

View File

@ -1,93 +0,0 @@
<template>
<article>
<my-header
:user="user"
@login="onLogin"
@logout="onLogout"
@create-account="onCreateAccount"
/>
<section>
<h2>Pages in Storybook</h2>
<p>
We recommend building UIs with a
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
<strong>component-driven</strong>
</a>
process starting with atomic components and ending with pages.
</p>
<p>
Render pages with mock data. This makes it easy to build and review page states
without needing to navigate to them in your app. Here are some handy patterns
for managing page data in Storybook:
</p>
<ul>
<li>
Use a higher-level connected component. Storybook helps you compose such data
from the "args" of child component stories
</li>
<li>
Assemble data in the page component from your services. You can mock these
services out using Storybook.
</li>
</ul>
<p>
Get a guided tutorial on component-driven development at
<a
href="https://storybook.js.org/tutorials/"
target="_blank"
rel="noopener noreferrer"
>
Storybook tutorials
</a>
. Read more in the
<a
href="https://storybook.js.org/docs"
target="_blank"
rel="noopener noreferrer"
>
docs
</a>
.
</p>
<div class="tip-wrapper">
<span class="tip">Tip</span>
Adjust the width of the canvas with the
<svg
width="10"
height="10"
viewBox="0 0 12 12"
xmlns="http://www.w3.org/2000/svg"
>
<g fill="none" fill-rule="evenodd">
<path
id="a"
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
fill="#999"
/>
</g>
</svg>
Viewports addon in the toolbar
</div>
</section>
</article>
</template>
<script lang="ts" setup>
import MyHeader from "./ExampleHeader.vue";
import "./page.css";
import { ref } from "vue";
const user = ref<{ name: string } | null>(null);
const onLogin = () => {
user.value = { name: "Jane Doe" };
};
const onLogout = () => {
user.value = null;
};
const onCreateAccount = () => {
user.value = { name: "Jane Doe" };
};
</script>

View File

@ -1,217 +0,0 @@
import { Meta } from "@storybook/blocks";
import Code from "./assets/code-brackets.svg";
import Colors from "./assets/colors.svg";
import Comments from "./assets/comments.svg";
import Direction from "./assets/direction.svg";
import Flow from "./assets/flow.svg";
import Plugin from "./assets/plugin.svg";
import Repo from "./assets/repo.svg";
import StackAlt from "./assets/stackalt.svg";
<Meta title="Example/Introduction" />
<style>
{`
.subheading {
--mediumdark: '#999999';
font-weight: 700;
font-size: 13px;
color: #999;
letter-spacing: 6px;
line-height: 24px;
text-transform: uppercase;
margin-bottom: 12px;
margin-top: 40px;
}
.link-list {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 1fr 1fr;
row-gap: 10px;
}
@media (min-width: 620px) {
.link-list {
row-gap: 20px;
column-gap: 20px;
grid-template-columns: 1fr 1fr;
}
}
@media all and (-ms-high-contrast:none) {
.link-list {
display: -ms-grid;
-ms-grid-columns: 1fr 1fr;
-ms-grid-rows: 1fr 1fr;
}
}
.link-item {
display: block;
padding: 20px;
border: 1px solid #00000010;
border-radius: 5px;
transition: background 150ms ease-out, border 150ms ease-out, transform 150ms ease-out;
color: #333333;
display: flex;
align-items: flex-start;
}
.link-item:hover {
border-color: #1EA7FD50;
transform: translate3d(0, -3px, 0);
box-shadow: rgba(0, 0, 0, 0.08) 0 3px 10px 0;
}
.link-item:active {
border-color: #1EA7FD;
transform: translate3d(0, 0, 0);
}
.link-item strong {
font-weight: 700;
display: block;
margin-bottom: 2px;
}
.link-item img {
height: 40px;
width: 40px;
margin-right: 15px;
flex: none;
}
.link-item span,
.link-item p {
margin: 0;
font-size: 14px;
line-height: 20px;
}
.tip {
display: inline-block;
border-radius: 1em;
font-size: 11px;
line-height: 12px;
font-weight: 700;
background: #E7FDD8;
color: #66BF3C;
padding: 4px 12px;
margin-right: 10px;
vertical-align: top;
}
.tip-wrapper {
font-size: 13px;
line-height: 20px;
margin-top: 40px;
margin-bottom: 40px;
}
.tip-wrapper code {
font-size: 12px;
display: inline-block;
}
`}
</style>
# Welcome to Storybook
Storybook helps you build UI components in isolation from your app's business logic, data, and context.
That makes it easy to develop hard-to-reach states. Save these UI states as **stories** to revisit during development, testing, or QA.
Browse example stories now by navigating to them in the sidebar.
View their code in the `stories` directory to learn how they work.
We recommend building UIs with a [**component-driven**](https://componentdriven.org) process starting with atomic components and ending with pages.
<div className="subheading">Configure</div>
<div className="link-list">
<a
className="link-item"
href="https://storybook.js.org/docs/react/addons/addon-types"
target="_blank"
>
<img src={Plugin} alt="plugin" />
<span>
<strong>Presets for popular tools</strong>
Easy setup for TypeScript, SCSS and more.
</span>
</a>
<a
className="link-item"
href="https://storybook.js.org/docs/react/configure/webpack"
target="_blank"
>
<img src={StackAlt} alt="Build" />
<span>
<strong>Build configuration</strong>
How to customize webpack and Babel
</span>
</a>
<a
className="link-item"
href="https://storybook.js.org/docs/react/configure/styling-and-css"
target="_blank"
>
<img src={Colors} alt="colors" />
<span>
<strong>Styling</strong>
How to load and configure CSS libraries
</span>
</a>
<a
className="link-item"
href="https://storybook.js.org/docs/react/get-started/setup#configure-storybook-for-your-stack"
target="_blank"
>
<img src={Flow} alt="flow" />
<span>
<strong>Data</strong>
Providers and mocking for data libraries
</span>
</a>
</div>
<div className="subheading">Learn</div>
<div className="link-list">
<a className="link-item" href="https://storybook.js.org/docs" target="_blank">
<img src={Repo} alt="repo" />
<span>
<strong>Storybook documentation</strong>
Configure, customize, and extend
</span>
</a>
<a className="link-item" href="https://storybook.js.org/tutorials/" target="_blank">
<img src={Direction} alt="direction" />
<span>
<strong>In-depth guides</strong>
Best practices from leading teams
</span>
</a>
<a
className="link-item"
href="https://github.com/storybookjs/storybook"
target="_blank"
>
<img src={Code} alt="code" />
<span>
<strong>GitHub project</strong>
View the source and add issues
</span>
</a>
<a className="link-item" href="https://discord.gg/storybook" target="_blank">
<img src={Comments} alt="comments" />
<span>
<strong>Discord chat</strong>
Chat with maintainers and the community
</span>
</a>
</div>
<div className="tip-wrapper">
<span className="tip">Tip</span>Edit the Markdown in{" "}
<code>stories/Introduction.stories.mdx</code>
</div>

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/code-brackets</title><g id="illustration/code-brackets" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Combined-Shape" fill="#87E6E5" d="M11.4139325,12 C11.7605938,12 12,12.5059743 12,13.3779712 L12,17.4951758 L6.43502246,23.3839989 C5.85499251,23.9978337 5.85499251,25.0021663 6.43502246,25.6160011 L12,31.5048242 L12,35.6220288 C12,36.4939606 11.7605228,37 11.4139325,37 C11.2725831,37 11.1134406,36.9158987 10.9453839,36.7379973 L0.435022463,25.6160011 C-0.145007488,25.0021663 -0.145007488,23.9978337 0.435022463,23.3839989 L10.9453839,12.2620027 C11.1134051,12.0841663 11.2725831,12 11.4139325,12 Z M36.5860675,12 C36.7274169,12 36.8865594,12.0841013 37.0546161,12.2620027 L47.5649775,23.3839989 C48.1450075,23.9978337 48.1450075,25.0021663 47.5649775,25.6160011 L37.0546161,36.7379973 C36.8865949,36.9158337 36.7274169,37 36.5860675,37 C36.2394062,37 36,36.4940257 36,35.6220288 L36,31.5048242 L41.5649775,25.6160011 C42.1450075,25.0021663 42.1450075,23.9978337 41.5649775,23.3839989 L36,17.4951758 L36,13.3779712 C36,12.5060394 36.2394772,12 36.5860675,12 Z"/><rect id="Rectangle-7-Copy-5" width="35.57" height="4" x="5.009" y="22.662" fill="#A0DB77" rx="2" transform="translate(22.793959, 24.662305) rotate(-75.000000) translate(-22.793959, -24.662305)"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/comments</title><g id="illustration/comments" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Path" fill="#96D07C" d="M2.52730803,17.9196415 C2.44329744,17.9745167 2.36370847,18.000488 2.29303375,18.000488 C2.1197031,18.000488 2,17.8443588 2,17.5752855 L2,4 C2,1.790861 3.790861,3.23296945e-13 6,3.23296945e-13 L33.9995117,3.23296945e-13 C36.2086507,3.23296945e-13 37.9995117,1.790861 37.9995117,4 L37.9995117,9.999512 C37.9995117,12.208651 36.2086507,13.999512 33.9995117,13.999512 L8,13.999512 C7.83499225,13.999512 7.6723181,13.9895206 7.51254954,13.9701099 L2.52730803,17.9196415 Z"/><path id="Path" fill="#73E1E0" d="M7.51066,44.9703679 L2.52730803,47.9186655 C2.44329744,47.9735407 2.36370847,47.999512 2.29303375,47.999512 C2.1197031,47.999512 2,47.8433828 2,47.5743095 L2,35 C2,32.790861 3.790861,31 6,31 L26,31 C28.209139,31 30,32.790861 30,35 L30,41 C30,43.209139 28.209139,45 26,45 L8,45 C7.8343417,45 7.67103544,44.9899297 7.51066,44.9703679 Z"/><path id="Path" fill="#FFD476" d="M46,19.5 L46,33.0747975 C46,33.3438708 45.8802969,33.5 45.7069663,33.5 C45.6362915,33.5 45.5567026,33.4740287 45.472692,33.4191535 L40.4887103,29.4704446 C40.3285371,29.489956 40.1654415,29.5 40,29.5 L18,29.5 C15.790861,29.5 14,27.709139 14,25.5 L14,19.5 C14,17.290861 15.790861,15.5 18,15.5 L42,15.5 C44.209139,15.5 46,17.290861 46,19.5 Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/direction</title><g id="illustration/direction" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Combined-Shape" fill="#FFD476" d="M23.4917015,33.6030641 L2.93840258,31.4321033 C2.38917316,31.3740904 1.99096346,30.8818233 2.04897631,30.3325939 C2.0747515,30.0885705 2.18934861,29.8625419 2.37095722,29.6975265 L34.2609105,0.721285325 C34.6696614,0.349881049 35.3021022,0.38015648 35.6735064,0.788907393 C35.9232621,1.06377731 36.0001133,1.45442096 35.8730901,1.80341447 L24.5364357,32.9506164 C24.3793473,33.3822133 23.9484565,33.6513092 23.4917015,33.6030641 L23.4917015,33.6030641 Z"/><path id="Combined-Shape-Copy" fill="#FFC445" d="M24.3163597,33.2881029 C24.0306575,33.0138462 23.9337246,32.5968232 24.069176,32.2246735 L35.091923,1.9399251 C35.2266075,1.56988243 35.5659249,1.31333613 35.9586669,1.28460955 C36.5094802,1.24432106 36.9886628,1.65818318 37.0289513,2.20899647 L40.2437557,46.1609256 C40.2644355,46.4436546 40.1641446,46.7218752 39.9678293,46.9263833 C39.5853672,47.3248067 38.9523344,47.3377458 38.5539111,46.9552837 L24.3163597,33.2881029 L24.3163597,33.2881029 Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/flow</title><g id="illustration/flow" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Combined-Shape" fill="#79C9FC" fill-rule="nonzero" d="M30,29 C32.7614237,29 35,26.7614237 35,24 C35,14.6111593 27.3888407,7 18,7 C8.61115925,7 1,14.6111593 1,24 C1,33.3888407 8.61115925,41 18,41 C19.3333404,41 20.6447683,40.8466238 21.9154603,40.5471706 C19.5096374,39.3319645 17.5510566,37.8612875 16.0456579,36.1314815 C14.1063138,33.9030427 12.769443,31.0725999 12.0293806,27.6556449 C11.360469,26.565281 11,25.3082308 11,24 C11,20.1340068 14.1340068,17 18,17 C21.8659932,17 25,20.1340068 25,24 C25,26.125 27.7040312,29 30,29 Z"/><path id="Combined-Shape-Copy" fill="#FFC445" fill-rule="nonzero" d="M42,29 C44.7614237,29 47,26.7614237 47,24 C47,14.6111593 39.3888407,7 30,7 C20.6111593,7 13,14.6111593 13,24 C13,33.3888407 20.6111593,41 30,41 C31.3333404,41 32.6447683,40.8466238 33.9154603,40.5471706 C31.5096374,39.3319645 29.4051056,37.9781963 28.0456579,36.1314815 C26.0625,33.4375 23,27.1875 23,24 C23,20.1340068 26.1340068,17 30,17 C33.8659932,17 37,20.1340068 37,24 C37.02301,26.3435241 39.7040312,29 42,29 Z" transform="translate(30.000000, 24.000000) scale(-1, -1) translate(-30.000000, -24.000000)"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/plugin</title><g id="illustration/plugin" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Combined-Shape" fill="#79C9FC" d="M26,15.3994248 C26,15.4091303 26,15.4188459 26,15.4285714 L26,21.4694881 C25.8463595,21.4969567 25.6941676,21.51275 25.5873784,21.51275 C25.4974117,21.51275 25.4230979,21.4768034 25.377756,21.4206259 L25.2660784,21.2822603 L25.1317423,21.1657666 C24.2436317,20.3956144 23.100098,19.9633214 21.895551,19.9633214 C19.2039137,19.9633214 17,22.1075558 17,24.7804643 C17,27.4533728 19.2039137,29.5976071 21.895551,29.5976071 C23.1972122,29.5976071 24.3149423,29.2878193 25.1231445,28.3613697 C25.4542273,27.9818463 25.568273,27.9073214 25.5873784,27.9073214 C25.681532,27.9073214 25.8352452,27.9239643 26,27.9524591 L26,32.5714286 C26,32.5811541 26,32.5908697 26,32.6005752 L26,33 C26,35.209139 24.209139,37 22,37 L4,37 C1.790861,37 0,35.209139 0,33 L0,15 C0,12.790861 1.790861,11 4,11 L22,11 C24.209139,11 26,12.790861 26,15 L26,15.3994248 Z"/><path id="Path" fill="#87E6E5" d="M27.9998779,32.5714286 C27.9998779,33.3604068 28.6572726,34 29.4682101,34 L46.5315458,34 C47.3424832,34 47.9998779,33.3604068 47.9998779,32.5714286 L47.9998779,15.4285714 C47.9998779,14.6395932 47.3424832,14 46.5315458,14 L29.4682101,14 C28.6572726,14 27.9998779,14.6395932 27.9998779,15.4285714 L27.9998779,21.8355216 C27.9334367,22.2650514 27.8567585,22.6454496 27.746391,22.8084643 C27.4245309,23.2838571 26.2402709,23.51275 25.5873784,23.51275 C24.8705773,23.51275 24.2322714,23.1857725 23.8214379,22.6767605 C23.3096996,22.2329909 22.6349941,21.9633214 21.895551,21.9633214 C20.2963823,21.9633214 19,23.2245992 19,24.7804643 C19,26.3363293 20.2963823,27.5976071 21.895551,27.5976071 C22.5398535,27.5976071 23.2399343,27.477727 23.6160247,27.0466112 C24.1396029,26.4464286 24.7367044,25.9073214 25.5873784,25.9073214 C26.2402709,25.9073214 27.5912951,26.1766031 27.8226692,26.6116071 C27.8819199,26.7230038 27.9403239,26.921677 27.9998779,27.1556219 L27.9998779,32.5714286 Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/repo</title><g id="illustration/repo" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Rectangle-62-Copy" fill="#B7F0EF" d="M27.2217723,9.04506931 L41.2217723,6.2682098 C43.3886973,5.83840648 45.4937616,7.2466219 45.9235649,9.41354696 C45.9743993,9.66983721 46,9.93049166 46,10.1917747 L46,32.581381 C46,34.4904961 44.650862,36.1335143 42.7782277,36.5049459 L28.7782277,39.2818054 C26.6113027,39.7116087 24.5062384,38.3033933 24.0764351,36.1364682 C24.0256007,35.880178 24,35.6195235 24,35.3582405 L24,12.9686342 C24,11.0595191 25.349138,9.4165009 27.2217723,9.04506931 Z" opacity=".7"/><path id="Combined-Shape" fill="#87E6E5" d="M6.77822775,6.2682098 L20.7782277,9.04506931 C22.650862,9.4165009 24,11.0595191 24,12.9686342 L24,35.3582405 C24,37.5673795 22.209139,39.3582405 20,39.3582405 C19.738717,39.3582405 19.4780625,39.3326398 19.2217723,39.2818054 L5.22177225,36.5049459 C3.34913798,36.1335143 2,34.4904961 2,32.581381 L2,10.1917747 C2,7.98263571 3.790861,6.19177471 6,6.19177471 C6.26128305,6.19177471 6.5219375,6.21737537 6.77822775,6.2682098 Z"/><path id="Rectangle-63-Copy-2" fill="#61C1FD" d="M22,10 C23.1666667,10.2291667 24.0179036,10.625 24.5537109,11.1875 C25.0895182,11.75 25.5716146,12.875 26,14.5625 C26,29.3020833 26,37.5208333 26,39.21875 C26,40.9166667 26.4241536,42.9583333 27.2724609,45.34375 L24.5537109,41.875 L22.9824219,45.34375 C22.327474,43.1979167 22,41.2291667 22,39.4375 C22,37.6458333 22,27.8333333 22,10 Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/stackalt</title><g id="illustration/stackalt" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Combined-Shape" fill="#FFAE00" d="M23.8628277,0 L23.8628277,48 L3.32291648,36.2491883 L3.32155653,11.9499781 L23.8628277,0 Z M23.8670509,0 L44.408322,11.9499781 L44.4069621,36.2491883 L23.8670509,48 L23.8670509,0 Z" opacity=".196"/><path id="Rectangle-46-Copy-3" fill="#66BF3C" d="M15.8232279,19.1155258 L24.7368455,21.4714881 C29.6053842,22.7582937 33.4077423,26.5606518 34.694548,31.4291905 L37.0505103,40.3428082 C37.6150232,42.4786032 36.3412474,44.6676353 34.2054524,45.2321482 C33.5569474,45.4035549 32.87575,45.4091235 32.2245294,45.2483418 L23.3459013,43.0562718 C18.2976962,41.809906 14.3561301,37.8683399 13.1097642,32.8201348 L10.9176943,23.9415066 C10.3881737,21.7967682 11.6975664,19.6288529 13.8423049,19.0993322 C14.4935255,18.9385505 15.1747229,18.9441191 15.8232279,19.1155258 Z" opacity=".5" transform="translate(23.999997, 32.166058) rotate(-45.000000) translate(-23.999997, -32.166058)"/><path id="Rectangle-46-Copy-2" fill="#FFAE00" d="M15.8232279,11.2216893 L24.7368455,13.5776516 C29.6053842,14.8644572 33.4077423,18.6668153 34.694548,23.5353541 L37.0505103,32.4489717 C37.6150232,34.5847667 36.3412474,36.7737988 34.2054524,37.3383117 C33.5569474,37.5097184 32.87575,37.515287 32.2245294,37.3545053 L23.3459013,35.1624353 C18.2976962,33.9160695 14.3561301,29.9745034 13.1097642,24.9262983 L10.9176943,16.0476701 C10.3881737,13.9029317 11.6975664,11.7350164 13.8423049,11.2054957 C14.4935255,11.044714 15.1747229,11.0502826 15.8232279,11.2216893 Z" opacity=".5" transform="translate(23.999997, 24.272222) rotate(-45.000000) translate(-23.999997, -24.272222)"/><path id="Rectangle-46-Copy" fill="#FC521F" d="M15.8232279,3.32785281 L24.7368455,5.68381509 C29.6053842,6.97062075 33.4077423,10.7729788 34.694548,15.6415176 L37.0505103,24.5551352 C37.6150232,26.6909302 36.3412474,28.8799623 34.2054524,29.4444752 C33.5569474,29.6158819 32.87575,29.6214505 32.2245294,29.4606688 L23.3459013,27.2685988 C18.2976962,26.022233 14.3561301,22.0806669 13.1097642,17.0324618 L10.9176943,8.15383364 C10.3881737,6.00909519 11.6975664,3.84117987 13.8423049,3.31165925 C14.4935255,3.15087753 15.1747229,3.15644615 15.8232279,3.32785281 Z" opacity=".5" transform="translate(23.999997, 16.378385) rotate(-45.000000) translate(-23.999997, -16.378385)"/></g></svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1,30 +0,0 @@
.storybook-button {
font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: 700;
border: 0;
border-radius: 3em;
cursor: pointer;
display: inline-block;
line-height: 1;
}
.storybook-button--primary {
color: white;
background-color: #1ea7fd;
}
.storybook-button--secondary {
color: #333;
background-color: transparent;
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
}
.storybook-button--small {
font-size: 12px;
padding: 10px 16px;
}
.storybook-button--medium {
font-size: 14px;
padding: 11px 20px;
}
.storybook-button--large {
font-size: 16px;
padding: 12px 24px;
}

View File

@ -1,32 +0,0 @@
.wrapper {
font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
padding: 15px 20px;
display: flex;
align-items: center;
justify-content: space-between;
}
svg {
display: inline-block;
vertical-align: top;
}
h1 {
font-weight: 700;
font-size: 20px;
line-height: 1;
margin: 6px 0 6px 10px;
display: inline-block;
vertical-align: top;
}
button + button {
margin-left: 10px;
}
.welcome {
color: #333;
font-size: 14px;
margin-right: 10px;
}

View File

@ -1,69 +0,0 @@
section {
font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 24px;
padding: 48px 20px;
margin: 0 auto;
max-width: 600px;
color: #333;
}
section h2 {
font-weight: 700;
font-size: 32px;
line-height: 1;
margin: 0 0 4px;
display: inline-block;
vertical-align: top;
}
section p {
margin: 1em 0;
}
section a {
text-decoration: none;
color: #1ea7fd;
}
section ul {
padding-left: 30px;
margin: 1em 0;
}
section li {
margin-bottom: 8px;
}
section .tip {
display: inline-block;
border-radius: 1em;
font-size: 11px;
line-height: 12px;
font-weight: 700;
background: #e7fdd8;
color: #66bf3c;
padding: 4px 12px;
margin-right: 10px;
vertical-align: top;
}
section .tip-wrapper {
font-size: 13px;
line-height: 20px;
margin-top: 40px;
margin-bottom: 40px;
}
section .tip-wrapper svg {
display: inline-block;
height: 12px;
width: 12px;
margin-right: 4px;
vertical-align: top;
margin-top: 3px;
}
section .tip-wrapper svg path {
fill: #1ea7fd;
}

View File

@ -4,7 +4,6 @@ import {
getAssignmentTypeIcon,
getAssignmentTypeTitle,
} from "@/utils/utils";
import { useTranslation } from "i18next-vue";
export interface LearningContentIdentifier {
title: string;
@ -12,13 +11,13 @@ export interface LearningContentIdentifier {
}
export function learningContentTypeData(
lc: LearningContent
lc: LearningContent,
t: (key: string) => string
): LearningContentIdentifier {
const { t } = useTranslation();
switch (lc.content_type) {
case "learnpath.LearningContentAssignment": {
return {
title: getAssignmentTypeTitle(lc.assignment_type),
title: getAssignmentTypeTitle(lc.assignment_type, t),
icon: getAssignmentTypeIcon(lc.assignment_type),
};
}

View File

@ -1,5 +1,4 @@
import type { AssignmentType, CourseSession } from "@/types";
import { useTranslation } from "i18next-vue";
export function assertUnreachable(msg: string): never {
throw new Error("Didn't expect to get here, " + msg);
@ -37,9 +36,10 @@ export function getCockpitUrl(courseSlug: string | undefined): string {
return createCourseUrl(courseSlug, "cockpit");
}
export function getAssignmentTypeTitle(assignmentType: AssignmentType): string {
const { t } = useTranslation();
export function getAssignmentTypeTitle(
assignmentType: AssignmentType,
t: (key: string) => string
): string {
switch (assignmentType) {
case "CASEWORK":
return t("learningContentTypes.casework");

View File

@ -128,31 +128,19 @@ textarea {
}
.btn-primary {
@apply inline-block border-2 border-blue-900 bg-blue-900 px-4
py-2 align-middle font-semibold text-white
hover:border-blue-700 hover:bg-blue-700
disabled:cursor-not-allowed disabled:opacity-50;
@apply inline-block border-2 border-blue-900 bg-blue-900 px-4 py-2 align-middle font-semibold text-white hover:border-blue-700 hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50;
}
.btn-secondary {
@apply inline-block border-2 border-blue-900 bg-transparent px-4
py-2 align-middle font-semibold text-blue-900
hover:bg-gray-200
disabled:cursor-not-allowed disabled:opacity-50;
@apply inline-block border-2 border-blue-900 bg-transparent px-4 py-2 align-middle font-semibold text-blue-900 hover:bg-gray-200 disabled:cursor-not-allowed disabled:opacity-50;
}
.btn-blue {
@apply inline-block border-2 border-sky-500 bg-sky-500 px-4
py-2 align-middle font-semibold text-blue-900
hover:border-sky-400 hover:bg-sky-400
disabled:cursor-not-allowed disabled:opacity-50;
@apply inline-block border-2 border-sky-500 bg-sky-500 px-4 py-2 align-middle font-semibold text-blue-900 hover:border-sky-400 hover:bg-sky-400 disabled:cursor-not-allowed disabled:opacity-50;
}
.btn-text {
@apply inline-block px-4 py-2 align-middle font-normal
text-blue-900
hover:text-gray-700
disabled:cursor-not-allowed disabled:opacity-50;
@apply inline-block px-4 py-2 align-middle font-normal text-blue-900 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-50;
}
.btn-large-icon {

View File

@ -1,16 +1,17 @@
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"composite": true,
"ignoreDeprecations": "5.0",
"lib": ["ES2021", "DOM", "DOM.Iterable"],
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"paths": {
"@/*": ["./src/*"]
},
"strict": true
},
"exclude": ["src/**/__tests__/*", "src/**/*.cy.ts"],
"extends": "@vue/tsconfig/tsconfig.web.json",
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"]
}

View File

@ -1,8 +0,0 @@
{
"compilerOptions": {
"lib": ["es5", "dom"],
"target": "es5",
"types": ["cypress", "node"]
},
"include": ["src/**/*.cy.ts"]
}

View File

@ -2,16 +2,13 @@
"files": [],
"references": [
{
"path": "./tsconfig.vite-config.json"
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.vitest.json"
},
{
"path": "./tsconfig.cypress.json"
}
]
}

18
client/tsconfig.node.json Normal file
View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"noEmit": true,
"types": ["node"]
},
"extends": "@tsconfig/node20/tsconfig.json",
"include": [
"vite.config.*",
"vitest.config.*",
"cypress.config.*",
"nightwatch.conf.*",
"playwright.config.*"
]
}

View File

@ -1,8 +0,0 @@
{
"compilerOptions": {
"composite": true,
"types": ["node", "vitest"]
},
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["vite.config.*"]
}

View File

@ -2,7 +2,7 @@
"compilerOptions": {
"composite": true,
"lib": [],
"types": ["node", "jsdom", "vitest/globals"]
"types": ["node", "jsdom"]
},
"exclude": [],
"extends": "./tsconfig.app.json"

View File

@ -1,6 +1,5 @@
import { fileURLToPath, URL } from "url";
import { fileURLToPath, URL } from "node:url";
import alias from "@rollup/plugin-alias";
import vue from "@vitejs/plugin-vue";
import { defineConfig, loadEnv } from "vite";
@ -21,16 +20,6 @@ export default defineConfig(({ mode }) => {
// include: path.resolve(__dirname, './locales/**')
// }),
// won't work in vite's resolve.alias, so we'll make the alias here
alias({
// TODO: why is that used?
// entries: [
// {
// find: 'vue-i18n',
// replacement: path.resolve(__dirname, './node_modules/vue-i18n/dist/vue-i18n.runtime.esm-bundler.js')
// }
// ]
}),
],
define: {},
server: {
@ -48,6 +37,7 @@ export default defineConfig(({ mode }) => {
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./vitest.setup.ts"],
},
};
});

4
client/vitest.setup.ts Normal file
View File

@ -0,0 +1,4 @@
// vitest-setup.js
if (typeof globalThis.URL.createObjectURL === "undefined") {
globalThis.URL.createObjectURL = () => "http://mocked-url.com";
}

View File

@ -8,7 +8,7 @@
# > docker push iterativ/vbv-lernwelt-django
ARG PYTHON_VERSION=3.10-slim-bullseye
FROM node:16-bullseye-slim as client-builder
FROM node:20-bullseye-slim as client-builder
ARG APP_HOME=/app
WORKDIR ${APP_HOME}

View File

@ -1,11 +1,11 @@
# create a new version of this docker image
# > docker build --platform linux/amd64 -t iterativ/vbv-lernwelt-bitbucket .
# > docker build --platform linux/amd64 -t iterativ/vbv-lernwelt-bitbucket-node20 .
# push new version to Docker Hub
# > docker push iterativ/vbv-lernwelt-bitbucket
# > docker push iterativ/vbv-lernwelt-bitbucket-node20
# run locally with directory mounted
# > docker run -v "$(pwd)":/src -it iterativ/vbv-lernwelt-bitbucket /bin/bash
# > docker run -v "$(pwd)":/src -it iterativ/vbv-lernwelt-bitbucket-node20 /bin/bash
FROM cypress/included:10.9.0
FROM currentsdev/cypress-included:12.17.4
MAINTAINER Daniel Egger <daniel.egger@iterativ.ch>
# install python see https://github.com/docker-library/python
@ -161,7 +161,7 @@ RUN set -eux; \
pip --version
# install postgresql \
RUN apt install curl ca-certificates gnupg
RUN apt-get update && apt -y install curl ca-certificates gnupg
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| gpg --dearmor \
| tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null

918
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,9 +11,5 @@
"devDependencies": {
"cypress": "^12.15.0",
"cypress-cloud": "^1.7.4"
},
"dependencies": {
"i18next": "^23.2.6",
"pa11y": "^6.2.3"
}
}