first clean up
This commit is contained in:
13
.env
13
.env
@@ -1,6 +1,9 @@
|
|||||||
PROJECT_NAME=tibi-svelte-starter
|
PROJECT_NAME=__PROJECT_NAME__
|
||||||
TIBI_PREFIX=tibi
|
TIBI_PREFIX=tibi
|
||||||
TIBI_NAMESPACE=__NAMESPACE__
|
TIBI_NAMESPACE=__TIBI_NAMESPACE__
|
||||||
# code-server user
|
CODER_UID=100
|
||||||
UID=100
|
CODER_GID=101
|
||||||
GID=101
|
SENTRY_URL=https://sentry.basehosts.de
|
||||||
|
SENTRY_ORG=webmakers
|
||||||
|
SENTRY_PROJECT=
|
||||||
|
START_SCRIPT=:ssr
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"sourceMaps": "inline",
|
|
||||||
"inputSourceMap": true,
|
|
||||||
"plugins": ["istanbul"]
|
|
||||||
}
|
|
||||||
12
cypress.json
12
cypress.json
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"baseUrl": "http://localhost:3000",
|
|
||||||
"env": {
|
|
||||||
"mongodbUri": "mongodb://localhost",
|
|
||||||
"tibiApiUrl": "http://localhost:8080/api/v1",
|
|
||||||
"tibiDbPrefix": "tibi",
|
|
||||||
"tibiUsername": "admin",
|
|
||||||
"tibiPassword": "admin",
|
|
||||||
"projectApiConfig": "./api/config.yml",
|
|
||||||
"projectApiNamespace": "cypress_test"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Using fixtures to represent data",
|
|
||||||
"email": "hello@cypress.io",
|
|
||||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/// <reference types="cypress" />
|
|
||||||
|
|
||||||
const { before } = require("../../support")
|
|
||||||
|
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
describe("renz einfo auth", () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
before()
|
|
||||||
})
|
|
||||||
|
|
||||||
afterEach(function () {
|
|
||||||
if (this.currentTest.state === "failed") {
|
|
||||||
cy.setCookie("shouldSkip", "true")
|
|
||||||
Cypress.runner.stop()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
it("can visit homepage", () => {
|
|
||||||
cy.visit("/")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
/// <reference types="cypress" />
|
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
const { default: axios } = require("axios")
|
|
||||||
const { MongoClient } = require("mongodb")
|
|
||||||
const fs = require("fs")
|
|
||||||
const util = require("util")
|
|
||||||
|
|
||||||
// ***********************************************************
|
|
||||||
// This example plugins/index.js can be used to load plugins
|
|
||||||
//
|
|
||||||
// You can change the location of this file or turn off loading
|
|
||||||
// the plugins file with the 'pluginsFile' configuration option.
|
|
||||||
//
|
|
||||||
// You can read more here:
|
|
||||||
// https://on.cypress.io/plugins-guide
|
|
||||||
// ***********************************************************
|
|
||||||
|
|
||||||
// This function is called when a project is opened or re-opened (e.g. due to
|
|
||||||
// the project's config changing)
|
|
||||||
|
|
||||||
function logObj(o) {
|
|
||||||
console.log(util.inspect(o, false, null, true /* enable colors */))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {Cypress.PluginConfig}
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
module.exports = (on, config) => {
|
|
||||||
require("cypress-terminal-report/src/installLogsPrinter")(on, {
|
|
||||||
printLogsToConsole: "always",
|
|
||||||
includeSuccessfulHookLogs: true,
|
|
||||||
})
|
|
||||||
|
|
||||||
const registerCodeCoverageTask = require("@cypress/code-coverage/task")
|
|
||||||
|
|
||||||
// `on` is used to hook into various events Cypress emits
|
|
||||||
// `config` is the resolved Cypress config
|
|
||||||
on("before:run", async (details) => {
|
|
||||||
/*
|
|
||||||
if (details.specs && details.browser) {
|
|
||||||
// details.specs and details.browser will be undefined in interactive mode
|
|
||||||
console.log(
|
|
||||||
"Running",
|
|
||||||
details.specs.length,
|
|
||||||
"specs in",
|
|
||||||
details.browser.name
|
|
||||||
)
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (config.env.CI) {
|
|
||||||
// is continous integration test run, so initialize database
|
|
||||||
console.log("CI RUN: init database")
|
|
||||||
|
|
||||||
const tibiDbPrefix = config.env.tibiDbPrefix
|
|
||||||
const projectNamespace = config.env.projectApiNamespace
|
|
||||||
|
|
||||||
// drop database from tests before
|
|
||||||
console.log(" - connecting to mongodb: " + config.env.mongodbUri)
|
|
||||||
const dbClient = new MongoClient(config.env.mongodbUri)
|
|
||||||
await dbClient.connect()
|
|
||||||
console.log(" - removing project from tibi db")
|
|
||||||
let db = dbClient.db(tibiDbPrefix)
|
|
||||||
db.collection("project").deleteMany({ namespace: projectNamespace })
|
|
||||||
|
|
||||||
const dbName = tibiDbPrefix + "_" + projectNamespace
|
|
||||||
console.log(" - dropping database: " + dbName)
|
|
||||||
db = dbClient.db(dbName)
|
|
||||||
await db.dropDatabase()
|
|
||||||
|
|
||||||
// login
|
|
||||||
const apiUrl = config.env.tibiApiUrl
|
|
||||||
const l = await axios.post(apiUrl + "/login", {
|
|
||||||
username: config.env.tibiUsername,
|
|
||||||
password: config.env.tibiPassword,
|
|
||||||
})
|
|
||||||
const tibiToken = l.data.token
|
|
||||||
|
|
||||||
// create project
|
|
||||||
console.log(" - creating tibi project: " + projectNamespace)
|
|
||||||
let project
|
|
||||||
try {
|
|
||||||
const p = await axios.post(
|
|
||||||
apiUrl + "/project",
|
|
||||||
{
|
|
||||||
configFile: config.env.projectApiConfig,
|
|
||||||
name: projectNamespace,
|
|
||||||
namespace: projectNamespace,
|
|
||||||
description: projectNamespace,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
"X-Auth-Token": tibiToken,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
project = p.data
|
|
||||||
} catch (e) {
|
|
||||||
logObj(e)
|
|
||||||
throw e
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(" - checking project status: " + project.id)
|
|
||||||
try {
|
|
||||||
const p = await axios.get(apiUrl + "/project/" + project.id, {
|
|
||||||
headers: {
|
|
||||||
"X-Auth-Token": tibiToken,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if (!p.data.api.isOnline) {
|
|
||||||
throw p.data
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
logObj(e)
|
|
||||||
throw e
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO fill tibi database with test data
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return registerCodeCoverageTask(on, config)
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
// ***********************************************
|
|
||||||
// This example commands.js shows you how to
|
|
||||||
// create various custom commands and overwrite
|
|
||||||
// existing commands.
|
|
||||||
//
|
|
||||||
// For more comprehensive examples of custom
|
|
||||||
// commands please read more here:
|
|
||||||
// https://on.cypress.io/custom-commands
|
|
||||||
// ***********************************************
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// -- This is a parent command --
|
|
||||||
// Cypress.Commands.add('login', (email, password) => { ... })
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// -- This is a child command --
|
|
||||||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// -- This is a dual command --
|
|
||||||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// -- This will overwrite an existing command --
|
|
||||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
// ***********************************************************
|
|
||||||
// This example support/index.js is processed and
|
|
||||||
// loaded automatically before your test files.
|
|
||||||
//
|
|
||||||
// This is a great place to put global configuration and
|
|
||||||
// behavior that modifies Cypress.
|
|
||||||
//
|
|
||||||
// You can change the location of this file or turn off
|
|
||||||
// automatically serving support files with the
|
|
||||||
// 'supportFile' configuration option.
|
|
||||||
//
|
|
||||||
// You can read more here:
|
|
||||||
// https://on.cypress.io/configuration
|
|
||||||
// ***********************************************************
|
|
||||||
|
|
||||||
// Import commands.js using ES2015 syntax:
|
|
||||||
import "./commands"
|
|
||||||
|
|
||||||
import installLogsCollector from "cypress-terminal-report/src/installLogsCollector"
|
|
||||||
installLogsCollector()
|
|
||||||
|
|
||||||
import "@cypress/code-coverage/support"
|
|
||||||
|
|
||||||
// Alternatively you can use CommonJS syntax:
|
|
||||||
// require('./commands')
|
|
||||||
|
|
||||||
export const before = () => {
|
|
||||||
if (Cypress.browser.isHeaded) {
|
|
||||||
cy.clearCookie("shouldSkip")
|
|
||||||
} else {
|
|
||||||
cy.getCookie("shouldSkip").then((cookie) => {
|
|
||||||
if (
|
|
||||||
cookie &&
|
|
||||||
typeof cookie === "object" &&
|
|
||||||
cookie.value === "true"
|
|
||||||
) {
|
|
||||||
Cypress.runner.stop()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"include": ["**/*"],
|
|
||||||
"exclude": [],
|
|
||||||
"compilerOptions": {
|
|
||||||
"preserveValueImports": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
version: "3.8"
|
name: ${PROJECT_NAME}
|
||||||
name: tibi-svelte-starter-local
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
yarnstart:
|
yarnstart:
|
||||||
@@ -9,14 +8,8 @@ services:
|
|||||||
- ./:/data
|
- ./:/data
|
||||||
working_dir: /data
|
working_dir: /data
|
||||||
command: sh -c "yarn install && API_BASE=http://tibiserver:8080/api/v1/_/${TIBI_NAMESPACE} yarn start"
|
command: sh -c "yarn install && API_BASE=http://tibiserver:8080/api/v1/_/${TIBI_NAMESPACE} yarn start"
|
||||||
# ports:
|
|
||||||
# - ${PORT:-3000}:3000
|
|
||||||
# - ${BROWSERSYNC_PORT:-4001}:3001
|
|
||||||
expose:
|
expose:
|
||||||
- 3000
|
- 3000
|
||||||
# networks:
|
|
||||||
# - default
|
|
||||||
# - traefik_web
|
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- online.testversion.code.subdomain=${PROJECT_NAME}
|
- online.testversion.code.subdomain=${PROJECT_NAME}
|
||||||
@@ -30,7 +23,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./:/data
|
- ./:/data
|
||||||
environment:
|
environment:
|
||||||
# DB_DIAL: mongodb://root:root@mongo/admin
|
|
||||||
DB_DIAL: mongodb://mongo
|
DB_DIAL: mongodb://mongo
|
||||||
DB_PREFIX: ${TIBI_PREFIX}
|
DB_PREFIX: ${TIBI_PREFIX}
|
||||||
MAIL_HOST: maildev:25
|
MAIL_HOST: maildev:25
|
||||||
@@ -49,7 +41,6 @@ services:
|
|||||||
working_dir: /tibi-server
|
working_dir: /tibi-server
|
||||||
environment:
|
environment:
|
||||||
GOCACHE: /tmp/
|
GOCACHE: /tmp/
|
||||||
# DB_DIAL: mongodb://root:root@mongo/admin
|
|
||||||
DB_DIAL: mongodb://mongo
|
DB_DIAL: mongodb://mongo
|
||||||
DB_PREFIX: ${TIBI_PREFIX}
|
DB_PREFIX: ${TIBI_PREFIX}
|
||||||
MAIL_HOST: maildev:25
|
MAIL_HOST: maildev:25
|
||||||
@@ -68,13 +59,8 @@ services:
|
|||||||
PORT: 80
|
PORT: 80
|
||||||
depends_on:
|
depends_on:
|
||||||
- tibiserver
|
- tibiserver
|
||||||
# ports:
|
|
||||||
# - ${ADMIN_PORT:-3002}:80
|
|
||||||
expose:
|
expose:
|
||||||
- 80
|
- 80
|
||||||
# networks:
|
|
||||||
# - default
|
|
||||||
# - traefik_web
|
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- online.testversion.code.subdomain=${PROJECT_NAME}-tibiadmin
|
- online.testversion.code.subdomain=${PROJECT_NAME}-tibiadmin
|
||||||
@@ -103,15 +89,6 @@ services:
|
|||||||
user: ${UID}:${GID}
|
user: ${UID}:${GID}
|
||||||
volumes:
|
volumes:
|
||||||
- ./tmp/mongo-data:/data/db
|
- ./tmp/mongo-data:/data/db
|
||||||
# command: mongod --logpath=/dev/null
|
|
||||||
# environment:
|
|
||||||
# MONGO_INITDB_ROOT_USERNAME: root
|
|
||||||
# MONGO_INITDB_ROOT_PASSWORD: root
|
|
||||||
|
|
||||||
# adminder:
|
|
||||||
# image: gitbase.de/server/adminer
|
|
||||||
# ports:
|
|
||||||
# - ${PORT:-18080}:8080
|
|
||||||
|
|
||||||
adminmongo:
|
adminmongo:
|
||||||
image: gitbase.de/server/adminmongo
|
image: gitbase.de/server/adminmongo
|
||||||
@@ -121,13 +98,8 @@ services:
|
|||||||
# DB_PASSWORD: root
|
# DB_PASSWORD: root
|
||||||
DB_HOST: mongo
|
DB_HOST: mongo
|
||||||
PORT: 1234
|
PORT: 1234
|
||||||
# ports:
|
|
||||||
# - ${ADMINMONGO_PORT:-3003}:1234
|
|
||||||
expose:
|
expose:
|
||||||
- 1234
|
- 1234
|
||||||
# networks:
|
|
||||||
# - default
|
|
||||||
# - traefik_web
|
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- online.testversion.code.subdomain=${PROJECT_NAME}-adminmongo
|
- online.testversion.code.subdomain=${PROJECT_NAME}-adminmongo
|
||||||
@@ -136,21 +108,12 @@ services:
|
|||||||
|
|
||||||
maildev:
|
maildev:
|
||||||
image: maildev/maildev
|
image: maildev/maildev
|
||||||
# restart: always
|
|
||||||
# ports:
|
|
||||||
# - ${MAILDEV_PORT:-3004}:80
|
|
||||||
command: node bin/maildev --web 1080 --smtp 25 -v --hide-extensions=STARTTLS
|
command: node bin/maildev --web 1080 --smtp 25 -v --hide-extensions=STARTTLS
|
||||||
expose:
|
expose:
|
||||||
- 1080
|
- 1080
|
||||||
# networks:
|
|
||||||
# - default
|
|
||||||
# - traefik_web
|
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- online.testversion.code.subdomain=${PROJECT_NAME}-maildev
|
- online.testversion.code.subdomain=${PROJECT_NAME}-maildev
|
||||||
- traefik.http.services.${PROJECT_NAME}-maildev.loadbalancer.server.port=1080
|
- traefik.http.services.${PROJECT_NAME}-maildev.loadbalancer.server.port=1080
|
||||||
- traefik.http.routers.${PROJECT_NAME}-maildev.middlewares=${PROJECT_NAME}-maildev
|
- traefik.http.routers.${PROJECT_NAME}-maildev.middlewares=${PROJECT_NAME}-maildev
|
||||||
- traefik.http.middlewares.${PROJECT_NAME}-maildev.basicauth.usersfile=${PWD}/.basic-auth-code
|
- traefik.http.middlewares.${PROJECT_NAME}-maildev.basicauth.usersfile=${PWD}/.basic-auth-code
|
||||||
# networks:
|
|
||||||
# traefik_web:
|
|
||||||
# external: true
|
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
version: "3.9"
|
|
||||||
|
|
||||||
services:
|
|
||||||
maildev:
|
|
||||||
image: maildev/maildev
|
|
||||||
command:
|
|
||||||
[
|
|
||||||
node,
|
|
||||||
bin/maildev,
|
|
||||||
--web,
|
|
||||||
"80",
|
|
||||||
--smtp,
|
|
||||||
"25",
|
|
||||||
-v,
|
|
||||||
--hide-extensions=STARTTLS,
|
|
||||||
]
|
|
||||||
|
|
||||||
mongo:
|
|
||||||
image: mongo
|
|
||||||
|
|
||||||
tibi-server:
|
|
||||||
image: registry.webmakers.de/tibi/tibi-server
|
|
||||||
environment:
|
|
||||||
DB_DIAL: mongodb://mongo
|
|
||||||
API_PORT: 8080
|
|
||||||
MAIL_HOST: maildev:25
|
|
||||||
depends_on:
|
|
||||||
- maildev
|
|
||||||
- mongo
|
|
||||||
volumes:
|
|
||||||
- ./:/workdir
|
|
||||||
|
|
||||||
liveserver:
|
|
||||||
image: node
|
|
||||||
command: yarn run -- live-server --no-browser --port=80 --ignore='*' --entry-file=spa.html --no-css-inject --proxy=/api:http://tibi-server:8080/api/v1/_/einfo_test dist
|
|
||||||
depends_on:
|
|
||||||
- tibi-server
|
|
||||||
volumes:
|
|
||||||
- ./:/workdir
|
|
||||||
working_dir: /workdir
|
|
||||||
|
|
||||||
cypress:
|
|
||||||
#image: cypress/base
|
|
||||||
image: cypress/browsers:node14.17.0-chrome91-ff89
|
|
||||||
environment:
|
|
||||||
FORCE_COLOR: "true"
|
|
||||||
CYPRESS_BASE_URL: http://liveserver
|
|
||||||
CYPRESS_CI: "true"
|
|
||||||
CYPRESS_mongodbUri: mongodb://mongo
|
|
||||||
CYPRESS_tibiApiUrl: http://tibi-server:8080/api/v1
|
|
||||||
CYPRESS_projectApiConfig: /workdir/api/config.yml
|
|
||||||
#DISPLAY: host.docker.internal:0.0
|
|
||||||
DISPLAY: $DISPLAY
|
|
||||||
LIBGL_ALWAYS_INDIRECT: 1
|
|
||||||
command: sh ./scripts/cy-command.docker.sh $CY_COMMAND
|
|
||||||
#command: yarn cy:$CY_COMMAND
|
|
||||||
depends_on:
|
|
||||||
- liveserver
|
|
||||||
volumes:
|
|
||||||
- ./:/workdir
|
|
||||||
- ~/.cache:/home/node/.cache
|
|
||||||
- $HOME/.Xauthority:$HOME/.Xauthority
|
|
||||||
- /tmp/.X11-unix:/tmp/.X11-unix
|
|
||||||
working_dir: /workdir
|
|
||||||
user: $CURRENT_UID
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
const config = require("./esbuild.config.js")
|
|
||||||
|
|
||||||
config.options.sourcemap = "inline"
|
|
||||||
config.options.minify = false
|
|
||||||
|
|
||||||
module.exports = config
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
#export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
|
|
||||||
#export DISPLAY=host.docker.internal:0.0
|
|
||||||
rm -r coverage
|
|
||||||
rm -r .nyc_output
|
|
||||||
yarn build:instanbul
|
|
||||||
echo DISPLAY: $DISPLAY
|
|
||||||
yarn cy:$1
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import Image from "./Image.svelte"
|
|
||||||
|
|
||||||
export let collectionName: string = null
|
|
||||||
export let entryId: string = null
|
|
||||||
export let mediaFile: TibiArticleMediaFile = null
|
|
||||||
export let cssClass: string = ""
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Image collectionName="{collectionName}" entryId="{entryId}" file="{mediaFile.file}" cssClass="{cssClass}" />
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { fade } from "svelte/transition"
|
|
||||||
|
|
||||||
import { getGalleries } from "../../api"
|
|
||||||
import { apiBaseURL } from "../../config"
|
|
||||||
|
|
||||||
import Modal from "../__UNUSED__/widgets/Modal.svelte"
|
|
||||||
|
|
||||||
export let article
|
|
||||||
let galleries: Gallery[]
|
|
||||||
|
|
||||||
const loadLinkedGalleries = async () => {
|
|
||||||
galleries = await getGalleries(article?.galleries)
|
|
||||||
}
|
|
||||||
loadLinkedGalleries()
|
|
||||||
|
|
||||||
let selectedImage = null
|
|
||||||
let selectedGallery = null
|
|
||||||
const showDetails = (gallery, image) => {
|
|
||||||
selectedImage = image
|
|
||||||
selectedGallery = gallery
|
|
||||||
console.log(selectedGallery.items.indexOf(image))
|
|
||||||
}
|
|
||||||
const closeDetails = () => {
|
|
||||||
selectedImage = null
|
|
||||||
selectedGallery = null
|
|
||||||
}
|
|
||||||
|
|
||||||
const next = () => {
|
|
||||||
let nextImage
|
|
||||||
let nextIndex = selectedGallery.items.indexOf(selectedImage) + 1
|
|
||||||
if (!selectedGallery.items[nextIndex]) {
|
|
||||||
nextImage = selectedGallery.items[0]
|
|
||||||
} else {
|
|
||||||
nextImage = selectedGallery.items[nextIndex]
|
|
||||||
}
|
|
||||||
selectedImage = nextImage
|
|
||||||
}
|
|
||||||
|
|
||||||
const prev = () => {
|
|
||||||
let prevImage
|
|
||||||
let prevIndex = selectedGallery.items.indexOf(selectedImage) - 1
|
|
||||||
if (prevIndex < 0) {
|
|
||||||
prevImage = selectedGallery.items[selectedGallery.items.length - 1]
|
|
||||||
} else {
|
|
||||||
prevImage = selectedGallery.items[prevIndex]
|
|
||||||
}
|
|
||||||
selectedImage = prevImage
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleKeydown = (e) => {
|
|
||||||
if (e.keyCode === 37) {
|
|
||||||
prev()
|
|
||||||
}
|
|
||||||
if (e.keyCode === 39) {
|
|
||||||
next()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<svelte:window on:keydown="{handleKeydown}" />
|
|
||||||
|
|
||||||
<section class="galleries">
|
|
||||||
{#each galleries || [] as gallery}
|
|
||||||
<div class="gallery gallery-{gallery.variant}">
|
|
||||||
{#each gallery.items || [] as image, index}
|
|
||||||
<div class="gallery-item" on:click="{() => showDetails(gallery, image)}">
|
|
||||||
<img
|
|
||||||
src="{apiBaseURL}galleries/{gallery.id}/{image.file.src}?filter=s"
|
|
||||||
alt="{image.alt ? image.alt : image.title}"
|
|
||||||
/>
|
|
||||||
{#if gallery.variant === "simple-with-title"}
|
|
||||||
<div class="gallery-item-title">
|
|
||||||
{image.title}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
|
|
||||||
{#if selectedGallery && selectedImage}
|
|
||||||
<Modal show="{selectedGallery && selectedImage}">
|
|
||||||
<div transition:fade class="gallery-image-details">
|
|
||||||
<img
|
|
||||||
src="{apiBaseURL}galleries/{selectedGallery.id}/{selectedImage.file.src}?filter=l"
|
|
||||||
alt="{selectedImage.alt ? selectedImage.alt : selectedImage.title}"
|
|
||||||
on:click="{closeDetails}"
|
|
||||||
/>
|
|
||||||
<div class="gallery-info">
|
|
||||||
{#if selectedImage.title}
|
|
||||||
<div class="gallery-title">
|
|
||||||
{selectedImage.title}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{#if selectedImage.description}
|
|
||||||
<div class="gallery-description">
|
|
||||||
{selectedImage.description}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<div class="prev" on:click|preventDefault="{prev}">‹</div>
|
|
||||||
<div class="next" on:click|preventDefault="{next}">›</div>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
{/if}
|
|
||||||
</section>
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { generalInfo } from "../../store"
|
|
||||||
import { apiBaseURL } from "../../config"
|
|
||||||
|
|
||||||
export let id: string = null
|
|
||||||
export let cssClass: string = ""
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if id}
|
|
||||||
{#each $generalInfo?.media?.mediaFiles || [] as mediaFile}
|
|
||||||
{#if mediaFile.id === id && mediaFile.file}
|
|
||||||
{#if mediaFile.file.src.includes(";base64,")}
|
|
||||||
<img
|
|
||||||
src="{mediaFile.file.src}"
|
|
||||||
alt="{mediaFile.alternateText ? mediaFile.alternateText + ' - ' : ''}"
|
|
||||||
class="{cssClass}"
|
|
||||||
/>
|
|
||||||
{:else}
|
|
||||||
<img
|
|
||||||
src="{`${apiBaseURL}general/${$generalInfo?.id}/${mediaFile.file.src}?filter=l`}"
|
|
||||||
alt="{mediaFile.alternateText ? mediaFile.alternateText : mediaFile.file.path}"
|
|
||||||
class="{cssClass}"
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
{/if}
|
|
||||||
{/each}
|
|
||||||
{/if}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { generalInfo, ccTags } from "../../../store"
|
|
||||||
|
|
||||||
$: iframeTitle =
|
|
||||||
$generalInfo?.person?.salutation +
|
|
||||||
" " +
|
|
||||||
$generalInfo?.person?.firstname +
|
|
||||||
" " +
|
|
||||||
$generalInfo?.person?.lastname +
|
|
||||||
" - " +
|
|
||||||
$generalInfo?.person?.additional
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if $ccTags?.includes("googleMaps")}
|
|
||||||
<iframe
|
|
||||||
id="googleMaps"
|
|
||||||
title="{iframeTitle}"
|
|
||||||
src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d1342.4197187151062!2d10.4164909278422!3d50.56856037791808!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x2a509772539d6c1b!2sDr.%20med.%20Christine%20Wedekind!5e0!3m2!1sde!2sde!4v1652861335963!5m2!1sde!2sde"
|
|
||||||
allowfullscreen
|
|
||||||
loading="lazy"
|
|
||||||
referrerpolicy="no-referrer-when-downgrade"></iframe>
|
|
||||||
{/if}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { scale } from "svelte/transition"
|
|
||||||
|
|
||||||
export let show: boolean = false
|
|
||||||
export let size: string = "md"
|
|
||||||
|
|
||||||
const clickOnBackground = () => {
|
|
||||||
show = false
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="modal-wrapper" class:show on:click="{clickOnBackground}">
|
|
||||||
<div class="modal modal-{size}" transition:scale on:click|stopPropagation="{() => {}}">
|
|
||||||
{#if $$slots.close}
|
|
||||||
<div class="modal-close">
|
|
||||||
<slot name="close" />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{#if $$slots.header}
|
|
||||||
<div class="modal-header">
|
|
||||||
<slot name="header" />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{#if $$slots.default}
|
|
||||||
<div class="modal-content">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{#if $$slots.header}
|
|
||||||
<div class="modal-footer">
|
|
||||||
<slot name="footer" />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
export let entry: TibiArticle
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if entry}
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="article-details {entry?.article?.general?.type}">
|
|
||||||
{#if entry?.article?.content?.title}
|
|
||||||
<h1 class="article-title">{@html entry?.article?.content?.title}</h1>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if entry?.article?.content?.subtitle}
|
|
||||||
<div class="article-subtitle">{@html entry?.article?.content?.subtitle}</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if entry?.article?.content?.types?.teaser}
|
|
||||||
<div class="article-teaser">{@html entry?.article?.content?.types?.teaser}</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if entry?.article?.content?.types?.details}
|
|
||||||
<div class="article-details">{@html entry?.article?.content?.types?.details}</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
export let entry: TibiArticle
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if entry}
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="article-details {entry?.article?.general?.type}">
|
|
||||||
{#if entry?.article?.content?.title}
|
|
||||||
<h1 class="article-title">{@html entry?.article?.content?.title}</h1>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if entry?.article?.content?.subtitle}
|
|
||||||
<div class="article-subtitle">{@html entry?.article?.content?.subtitle}</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if entry?.article?.content?.types?.teaser}
|
|
||||||
<div class="article-teaser">{@html entry?.article?.content?.types?.teaser}</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if entry?.article?.content?.types?.details}
|
|
||||||
<div class="article-details">{@html entry?.article?.content?.types?.details}</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import Default from "./Default.svelte"
|
|
||||||
import News from "./News.svelte"
|
|
||||||
|
|
||||||
export default {
|
|
||||||
default: Default,
|
|
||||||
news: News,
|
|
||||||
}
|
|
||||||
12
types/global.d.ts
vendored
12
types/global.d.ts
vendored
@@ -131,15 +131,3 @@ interface Locale {
|
|||||||
key: string
|
key: string
|
||||||
title?: string
|
title?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// interface Gallery {
|
|
||||||
// id: string
|
|
||||||
// title: string
|
|
||||||
// variant: string
|
|
||||||
// items: {
|
|
||||||
// file: File
|
|
||||||
// title: string
|
|
||||||
// descrition: string
|
|
||||||
// alt: string
|
|
||||||
// }[]
|
|
||||||
// }
|
|
||||||
|
|||||||
Reference in New Issue
Block a user