Reformat, refactor some code and fix some linting errors
This commit is contained in:
parent
41b2357bf6
commit
6e85b3a9dc
|
|
@ -1,44 +1,88 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"
|
||||
/>
|
||||
<title>_APP_TITLE_</title>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
|
||||
<title>_APP_TITLE_</title>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css?family=Material+Icons"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css?family=Montserrat:400,600,800"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link
|
||||
href="https://use.typekit.net/tck7ptw.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet" type="text/css" />
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,600,800" rel="stylesheet" />
|
||||
<link href="https://use.typekit.net/tck7ptw.css" rel="stylesheet" />
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="180x180"
|
||||
href="/static/apple-touch-icon.png"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="32x32"
|
||||
href="_FAVICON_32_"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="16x16"
|
||||
href="_FAVICON_16_"
|
||||
/>
|
||||
<link
|
||||
rel="manifest"
|
||||
href="/static/site.webmanifest"
|
||||
/>
|
||||
<link
|
||||
rel="mask-icon"
|
||||
href="/static/safari-pinned-tab.svg"
|
||||
color="#5bbad5"
|
||||
/>
|
||||
<meta
|
||||
name="msapplication-TileColor"
|
||||
content="#da532c"
|
||||
/>
|
||||
<meta
|
||||
name="theme-color"
|
||||
content="#ffffff"
|
||||
/>
|
||||
<!-- for sentry replay web worker -->
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="worker-src 'self' blob:;"
|
||||
/>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/static/apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="_FAVICON_32_" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="_FAVICON_16_" />
|
||||
<link rel="manifest" href="/static/site.webmanifest" />
|
||||
<link rel="mask-icon" href="/static/safari-pinned-tab.svg" color="#5bbad5" />
|
||||
<meta name="msapplication-TileColor" content="#da532c" />
|
||||
<meta name="theme-color" content="#ffffff" />
|
||||
<!-- for sentry replay web worker -->
|
||||
<meta http-equiv="Content-Security-Policy" content="worker-src 'self' blob:;" />
|
||||
|
||||
<script>
|
||||
window.UPLOADCARE_PUBLIC_KEY = '78212ff39934a59775ac';
|
||||
window.UPLOADCARE_LOCALE = 'de';
|
||||
window.UPLOADCARE_LOCALE_TRANSLATIONS = {
|
||||
dialog: {
|
||||
tabs: {
|
||||
file: {
|
||||
drag: 'Ziehen Sie ein Bild hier hinein',
|
||||
button: 'Wählen Sie ein lokales Bild',
|
||||
<script>
|
||||
window.UPLOADCARE_PUBLIC_KEY = '78212ff39934a59775ac';
|
||||
window.UPLOADCARE_LOCALE = 'de';
|
||||
window.UPLOADCARE_LOCALE_TRANSLATIONS = {
|
||||
dialog: {
|
||||
tabs: {
|
||||
file: {
|
||||
drag: 'Ziehen Sie ein Bild hier hinein',
|
||||
button: 'Wählen Sie ein lokales Bild',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script
|
||||
type="module"
|
||||
src="/src/main.ts"
|
||||
></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div
|
||||
:class="{ 'hideable-element--greyed-out': isHidden }"
|
||||
class="content-block__container hideable-element content-list__parent"
|
||||
ref="wrapper"
|
||||
ref="contentBlockDiv"
|
||||
>
|
||||
<div
|
||||
:class="specialClass"
|
||||
|
|
@ -137,7 +137,7 @@ const ContentComponent = defineAsyncComponent(() => import('@/components/content
|
|||
|
||||
const { me, schoolClass } = getMe();
|
||||
|
||||
const wrapper = ref<HTMLElement | null>(null);
|
||||
const contentBlockDiv = ref<HTMLElement | null>(null);
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
|
@ -245,7 +245,7 @@ const { mutate: doDeleteContentBlock } = useMutation(DELETE_CONTENT_BLOCK_MUTATI
|
|||
}));
|
||||
|
||||
onMounted(() => {
|
||||
const element = wrapper.value;
|
||||
const element = contentBlockDiv.value;
|
||||
|
||||
if (element !== null) {
|
||||
if (route.hash === `#${props.contentBlock.id}`) {
|
||||
|
|
@ -265,7 +265,7 @@ onMounted(() => {
|
|||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
const element = wrapper.value;
|
||||
const element = contentBlockDiv.value;
|
||||
|
||||
if (element !== null) {
|
||||
console.log('unmounting');
|
||||
|
|
@ -309,14 +309,9 @@ const specialClass = computed(() => `content-block--${props.contentBlock.type.to
|
|||
const isInstrumentBlock = computed(() => !!props.contentBlock.instrumentCategory);
|
||||
|
||||
// todo: use dynamic css class with v-bind once we're on Vue 3: https://vuejs.org/api/sfc-css-features.html#v-bind-in-css
|
||||
const instrumentStyle = computed(() => {
|
||||
if (isInstrumentBlock.value) {
|
||||
return {
|
||||
backgroundColor: props.contentBlock.instrumentCategory.background,
|
||||
};
|
||||
}
|
||||
return {};
|
||||
});
|
||||
const instrumentStyle = computed(() =>
|
||||
isInstrumentBlock.value ? { backgroundColor: props.contentBlock.instrumentCategory?.background || '' } : {}
|
||||
);
|
||||
const instrumentLabel = computed(() => {
|
||||
const contentType = props.contentBlock.type.toLowerCase();
|
||||
if (contentType.startsWith('base')) {
|
||||
|
|
@ -324,7 +319,7 @@ const instrumentLabel = computed(() => {
|
|||
return instrumentCategory(contentType);
|
||||
}
|
||||
if (isInstrumentBlock.value) {
|
||||
return instrumentCategory(props.contentBlock.instrumentCategory.name);
|
||||
return instrumentCategory(props.contentBlock.instrumentCategory?.name);
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
|
@ -332,7 +327,7 @@ const instrumentLabel = computed(() => {
|
|||
const instrumentLabelStyle = computed(() => {
|
||||
if (isInstrumentBlock.value) {
|
||||
return {
|
||||
color: props.contentBlock.instrumentCategory.foreground,
|
||||
color: props.contentBlock.instrumentCategory?.foreground,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue