Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from AzuraCast:main #64

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/components/Account/ApiKeyModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import {useVuelidateOnForm} from "~/functions/useVuelidateOnForm";
import {useAxios} from "~/vendor/axios";
import Modal from "~/components/Common/Modal.vue";
import {ModalTemplateRef, useHasModal} from "~/functions/useHasModal.ts";
import {ComponentExposed} from "vue-component-type-helpers";

const props = defineProps<{
createUrl: string,
Expand Down Expand Up @@ -107,7 +108,7 @@ const create = () => {
show();
};

const $field = ref<InstanceType<typeof FormGroupField> | null>(null);
const $field = ref<ComponentExposed<typeof FormGroupField> | null>(null);

const onShown = () => {
nextTick(() => {
Expand Down
2 changes: 0 additions & 2 deletions frontend/components/Admin/Stations/StationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ const props = withDefaults(
isRsasInstalled: false,
isShoutcastInstalled: false,
isStereoToolInstalled: false,
createUrl: null,
editUrl: null,
isModal: false
}
);
Expand Down
1 change: 0 additions & 1 deletion frontend/components/Common/AudioPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const props = withDefaults(
isMuted?: boolean
}>(),
{
title: null,
volume: 55,
isMuted: false
}
Expand Down
2 changes: 0 additions & 2 deletions frontend/components/Common/Avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ const props = withDefaults(
width?: number
}>(),
{
service: null,
serviceUrl: null,
width: 64
}
);
Expand Down
19 changes: 6 additions & 13 deletions frontend/components/Common/BitrateOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,37 +70,30 @@
</form-group>
</template>

<script setup lang="ts">
import {FormFieldProps, useFormField} from "~/components/Form/useFormField";
<script setup lang="ts" generic="T = string | number">
import {FormFieldEmits, FormFieldProps, useFormField} from "~/components/Form/useFormField";
import {computed, useSlots, WritableComputedRef} from "vue";
import {includes, map} from "lodash";
import useSlotsExcept from "~/functions/useSlotsExcept.ts";
import FormMultiCheck from "~/components/Form/FormMultiCheck.vue";
import FormLabel, {FormLabelParentProps} from "~/components/Form/FormLabel.vue";
import FormGroup from "~/components/Form/FormGroup.vue";

interface BitrateOptionsProps extends FormFieldProps, FormLabelParentProps {
interface BitrateOptionsProps extends FormFieldProps<T>, FormLabelParentProps {
id: string,
maxBitrate: number,
name?: string,
label?: string,
description?: string,
}

const props = withDefaults(
defineProps<BitrateOptionsProps>(),
{
name: null,
label: null,
description: null,
}
);
const props = defineProps<BitrateOptionsProps>();

const slots = useSlots();

const emit = defineEmits(['update:modelValue']);
const emit = defineEmits<FormFieldEmits<T>>();

const {model, isRequired} = useFormField(props, emit);
const {model, isRequired} = useFormField<T>(props, emit);

const radioBitrates = [
32, 48, 64, 96, 128, 192, 256, 320
Expand Down
1 change: 0 additions & 1 deletion frontend/components/Common/CardPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const props = withDefaults(
headerId?: string,
}>(),
{
title: null,
headerId: 'card_hdr'
}
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/Common/Charts/TimeSeriesChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import ChartAltValues from "~/components/Common/Charts/ChartAltValues.vue";
import useChart, {ChartProps, ChartTemplateRef} from "~/functions/useChart";
import {useLuxon} from "~/vendor/luxon";

interface TimeSeriesChartProps extends ChartProps {
interface TimeSeriesChartProps extends ChartProps<'line'> {
tz?: string,
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/Common/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface DialogResponse {
}

export interface DialogComponentProps extends DialogOptions {
resolvePromise(body: DialogResponse)
resolvePromise(body: DialogResponse): void
}
</script>

Expand Down
2 changes: 0 additions & 2 deletions frontend/components/Common/GridLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ export interface GridLayoutProps {
}

const props = withDefaults(defineProps<GridLayoutProps>(), {
id: null,
apiUrl: null,
paginated: false,
loading: false,
hideOnLoading: true,
Expand Down
3 changes: 1 addition & 2 deletions frontend/components/Common/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ const props = withDefaults(
{
active: false,
busy: false,
size: 'md',
title: null
size: 'md'
}
);

Expand Down
3 changes: 1 addition & 2 deletions frontend/components/Common/ModalForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ const props = withDefaults(
id: 'edit-modal',
loading: false,
disableSaveButton: false,
noEnforceFocus: false,
error: null
noEnforceFocus: false
}
);

Expand Down
1 change: 0 additions & 1 deletion frontend/components/Common/PaginationItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const props = withDefaults(
}>(),
{
page: 1,
label: null,
active: false,
disabled: false,
}
Expand Down
5 changes: 2 additions & 3 deletions frontend/components/Common/PlayButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ const props = withDefaults(
url: string,
isStream?: boolean,
isHls?: boolean,
iconClass?: stringm
iconClass?: string
}>(),
{
isStream: false,
isHls: false,
iconClass: null
isHls: false
}
);

Expand Down
22 changes: 13 additions & 9 deletions frontend/components/Common/SidebarMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class="nav-item"
>
<router-link
v-if="isRouteLink(category)"
v-if="isRouteLink(category.url)"
:class="getLinkClass(category)"
:to="category.url"
class="nav-link"
Expand Down Expand Up @@ -49,7 +49,7 @@
class="nav-item"
>
<router-link
v-if="isRouteLink(item)"
v-if="isRouteLink(item.url)"
:to="item.url"
class="nav-link ps-4 py-2"
:class="getLinkClass(item)"
Expand Down Expand Up @@ -85,25 +85,29 @@ import Icon from "~/components/Common/Icon.vue";
import {useRoute} from "vue-router";
import {some} from "lodash";
import {IconOpenInNew} from "~/components/Common/icons.ts";
import {MenuCategory, MenuSubCategory, ReactiveMenu} from "~/functions/filterMenu.ts";
import {MenuCategory, MenuRouteBasedUrl, MenuRouteUrl, MenuSubCategory} from "~/functions/filterMenu.ts";

const props = defineProps<{
menu: ReactiveMenu
menu: MenuCategory[]
}>();

const currentRoute = useRoute();

const isRouteLink = (item: MenuSubCategory) => {
return (typeof (item.url) !== 'undefined')
&& (typeof (item.url) !== 'string');
const isRouteLink = (url: MenuRouteUrl): url is MenuRouteBasedUrl => {
return (typeof (url) !== 'undefined')
&& (typeof (url) !== 'string');
};

const isCategory = (item: MenuCategory | MenuSubCategory): item is MenuCategory => {
return 'items' in item;
}

const isActiveItem = (item: MenuCategory | MenuSubCategory) => {
if ('items' in item && some(item.items, isActiveItem)) {
if (isCategory(item) && some(item.items ?? [], isActiveItem)) {
return true;
}

return isRouteLink(item) && !('params' in item.url) && item.url.name === currentRoute.name;
return isRouteLink(item.url) && !('params' in item.url) && item.url.name === currentRoute.name;
};

const getLinkClass = (item: MenuSubCategory) => {
Expand Down
8 changes: 1 addition & 7 deletions frontend/components/Common/Tab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
<script setup lang="ts">
import {TabChildProps, useTabChild} from "~/functions/tabs.ts";

const props = withDefaults(
defineProps<TabChildProps>(),
{
id: null,
itemHeaderClass: null,
}
);
const props = defineProps<TabChildProps>();

const {computedId, isActive, isLazy} = useTabChild(props);
</script>
1 change: 0 additions & 1 deletion frontend/components/Common/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import {TabParentProps, useTabParent} from "~/functions/tabs.ts";
const props = withDefaults(
defineProps<TabParentProps>(),
{
modelValue: null,
navTabsClass: 'nav-tabs',
contentClass: 'mt-3',
destroyOnHide: false,
Expand Down
10 changes: 5 additions & 5 deletions frontend/components/Common/TimeCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ import {isEmpty, padStart} from 'lodash';

const props = withDefaults(
defineProps<{
modelValue?: string
modelValue?: string | number | null
}>(),
{
modelValue: null,
}
);

const emit = defineEmits<{
(e: 'update:modelValue', value: string | null): void
(e: 'update:modelValue', value: number | null): void
}>();

const parseTimeCode = (timeCode) => {
const parseTimeCode = (timeCode: string | number | null) => {
if (timeCode !== '' && timeCode !== null) {
timeCode = padStart(timeCode, 4, '0');
timeCode = padStart(String(timeCode), 4, '0');
return timeCode.substring(0, 2) + ':' + timeCode.substring(2);
}

return null;
}

const convertToTimeCode = (time) => {
const convertToTimeCode = (time: string): number | null => {
if (isEmpty(time)) {
return null;
}
Expand Down
1 change: 0 additions & 1 deletion frontend/components/Common/Toast.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const props = withDefaults(
variant?: string,
}>(),
{
title: null,
variant: 'info',
}
);
Expand Down
15 changes: 5 additions & 10 deletions frontend/components/Common/Waveform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,11 @@ import usePlayerVolume from "~/functions/usePlayerVolume";
import useShowVolume from "~/functions/useShowVolume.ts";
import MuteButton from "~/components/Common/MuteButton.vue";

const props = withDefaults(
defineProps<{
audioUrl: string,
waveformUrl: string,
waveformCacheUrl?: string,
}>(),
{
waveformCacheUrl: null
}
);
const props = defineProps<{
audioUrl: string,
waveformUrl: string,
waveformCacheUrl?: string,
}>();

const emit = defineEmits(['ready']);

Expand Down
10 changes: 5 additions & 5 deletions frontend/components/Form/FormGroupCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
</form-group>
</template>

<script setup lang="ts">
<script setup lang="ts" generic="T = boolean | null">
import VuelidateError from "./VuelidateError.vue";
import FormLabel, {FormLabelParentProps} from "~/components/Form/FormLabel.vue";
import FormGroup from "~/components/Form/FormGroup.vue";
import {FormFieldProps, useFormField} from "~/components/Form/useFormField";
import {FormFieldEmits, FormFieldProps, useFormField} from "~/components/Form/useFormField";
import {useSlots} from "vue";
import FormCheckbox from "~/components/Form/FormCheckbox.vue";

interface FormGroupCheckboxProps extends FormFieldProps, FormLabelParentProps {
interface FormGroupCheckboxProps extends FormFieldProps<T>, FormLabelParentProps {
id: string,
name?: string,
label?: string,
Expand All @@ -80,7 +80,7 @@ const props = withDefaults(

const slots = useSlots();

const emit = defineEmits(['update:modelValue']);
const emit = defineEmits<FormFieldEmits<T>>();

const {model, isVuelidateField, isRequired} = useFormField(props, emit);
const {model, isVuelidateField, isRequired} = useFormField<T>(props, emit);
</script>
Loading
Loading