Skip to content

Commit

Permalink
use consistent double quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Oct 11, 2024
1 parent 4f717af commit afc1990
Show file tree
Hide file tree
Showing 98 changed files with 2,079 additions and 1,991 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ root = true
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
single_quote = true
single_quote = false
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
Expand Down
3 changes: 1 addition & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ module.exports = {
],
plugins: ['prettier', '@typescript-eslint'],
rules: {
quotes: ['error', 'single'],
quotes: ['error', 'double'],
'prettier/prettier': [
'error',
{
singleQuote: true,
endOfLine: 'auto',
},
],
Expand Down
4 changes: 2 additions & 2 deletions env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* eslint-disable no-unused-vars */
/// <reference types="vite/client" />

declare module 'virtual:pwa-register/vue' {
import type { Ref } from 'vue';
declare module "virtual:pwa-register/vue" {
import type { Ref } from "vue";

export interface RegisterSWOptions {
immediate?: boolean;
Expand Down
58 changes: 29 additions & 29 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
</template>

<script setup lang="ts">
import { api } from '@/plugins/api';
import { onMounted } from 'vue';
import { useTheme } from 'vuetify';
import { store } from '@/plugins/store';
import { i18n } from '@/plugins/i18n';
import router from './plugins/router';
import { EventType } from './plugins/api/interfaces';
import { api } from "@/plugins/api";
import { onMounted } from "vue";
import { useTheme } from "vuetify";
import { store } from "@/plugins/store";
import { i18n } from "@/plugins/i18n";
import router from "./plugins/router";
import { EventType } from "./plugins/api/interfaces";
const theme = useTheme();
const setTheme = function () {
const themePref = localStorage.getItem('frontend.settings.theme') || 'auto';
if (themePref == 'dark') {
const themePref = localStorage.getItem("frontend.settings.theme") || "auto";
if (themePref == "dark") {
// forced dark mode
theme.global.name.value = 'dark';
} else if (themePref == 'light') {
theme.global.name.value = "dark";
} else if (themePref == "light") {
// forced light mode
theme.global.name.value = 'light';
theme.global.name.value = "light";
} else if (
window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches
window.matchMedia("(prefers-color-scheme: dark)").matches
) {
// dark mode is enabled in browser
theme.global.name.value = 'dark';
theme.global.name.value = "dark";
} else {
// light mode is enabled in browser
theme.global.name.value = 'light';
theme.global.name.value = "light";
}
};
Expand All @@ -38,31 +38,31 @@ onMounted(() => {
// set navigation menu style
store.navigationMenuStyle =
localStorage.getItem('frontend.settings.menu_style') || 'horizontal';
localStorage.getItem("frontend.settings.menu_style") || "horizontal";
// cache some settings in the store
const langPref = localStorage.getItem('frontend.settings.language') || 'auto';
if (langPref !== 'auto') {
const langPref = localStorage.getItem("frontend.settings.language") || "auto";
if (langPref !== "auto") {
i18n.global.locale.value = langPref;
}
// set color theme (and listen for color scheme changes from browser)
setTheme();
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', setTheme);
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", setTheme);
// Initialize API Connection
// TODO: retrieve serveraddress through discovery and/or user settings ?
let serverAddress = '';
if (process.env.NODE_ENV === 'development') {
serverAddress = localStorage.getItem('mass_debug_address') || '';
let serverAddress = "";
if (process.env.NODE_ENV === "development") {
serverAddress = localStorage.getItem("mass_debug_address") || "";
if (!serverAddress) {
serverAddress =
prompt(
'Enter location of the Music Assistant server',
window.location.origin.replace('3000', '8095'),
) || '';
localStorage.setItem('mass_debug_address', serverAddress);
"Enter location of the Music Assistant server",
window.location.origin.replace("3000", "8095"),
) || "";
localStorage.setItem("mass_debug_address", serverAddress);
}
} else {
const loc = window.location;
Expand All @@ -75,8 +75,8 @@ onMounted(() => {
// redirect the user to the settings page if this is a fresh install
// TO be replaced with some nice onboarding wizard!
if (api.serverInfo.value?.onboard_done === false) {
console.info('Onboarding not done, redirecting to settings');
router.push('/settings');
console.info("Onboarding not done, redirecting to settings");
router.push("/settings");
}
store.libraryArtistsCount = await api.getLibraryArtistsCount();
store.libraryAlbumsCount = await api.getLibraryAlbumsCount();
Expand Down
38 changes: 19 additions & 19 deletions src/components/AddManualLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
<v-card-actions>
<v-spacer />
<v-btn variant="outlined" @click="model = false">{{
$t('cancel')
$t("cancel")
}}</v-btn>
<v-btn
variant="flat"
color="primary"
:disabled="loading"
@click="save"
>{{ $t('save') }}</v-btn
>{{ $t("save") }}</v-btn
>
</v-card-actions>
</div>
Expand All @@ -46,22 +46,22 @@
</template>

<script setup lang="ts">
import { ImageType, MediaType } from '@/plugins/api/interfaces';
import type { Radio, Track } from '@/plugins/api/interfaces';
import { ref, watch } from 'vue';
import api from '@/plugins/api';
import { store } from '@/plugins/store';
import Toolbar from '@/components/Toolbar.vue';
import { ImageType, MediaType } from "@/plugins/api/interfaces";
import type { Radio, Track } from "@/plugins/api/interfaces";
import { ref, watch } from "vue";
import api from "@/plugins/api";
import { store } from "@/plugins/store";
import Toolbar from "@/components/Toolbar.vue";

export interface Props {
type: MediaType;
}

const model = defineModel<boolean>();
const compProps = defineProps<Props>();
const url = ref<string>('');
const name = ref<string>('');
const image = ref<string>('');
const url = ref<string>("");
const name = ref<string>("");
const image = ref<string>("");
const loading = ref<boolean>(false);
const itemDetails = ref<Radio | Track>();

Expand All @@ -70,9 +70,9 @@ watch(
(active) => {
if (active != null) store.dialogActive = active;
if (active == false) {
url.value = '';
name.value = '';
image.value = '';
url.value = "";
name.value = "";
image.value = "";
itemDetails.value = undefined;
}
},
Expand All @@ -85,7 +85,7 @@ watch(
if (details) {
if (!name.value) name.value = details.name;
for (const img of details.metadata.images || []) {
if (img.type == 'thumb') {
if (img.type == "thumb") {
image.value = img.path;
break;
}
Expand All @@ -95,13 +95,13 @@ watch(
);

const fetchItemDetails = () => {
if (!url.value || !url.value.startsWith('http')) {
if (!url.value || !url.value.startsWith("http")) {
return;
}
loading.value = true;
if (compProps.type == MediaType.RADIO) {
api
.getRadio(url.value, 'builtin')
.getRadio(url.value, "builtin")
.then((x) => {
itemDetails.value = x;
})
Expand All @@ -114,7 +114,7 @@ const fetchItemDetails = () => {
});
} else {
api
.getTrack(url.value, 'builtin')
.getTrack(url.value, "builtin")
.then((x) => {
itemDetails.value = x;
})
Expand All @@ -140,7 +140,7 @@ const save = function () {
{
type: ImageType.THUMB,
path: image.value,
provider: 'builtin',
provider: "builtin",
remotely_accessible: true,
},
];
Expand Down
10 changes: 5 additions & 5 deletions src/components/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
</template>

<script setup lang="ts">
import { panelViewItemResponsive } from '@/helpers/utils';
import { getBreakpointValue } from '@/plugins/breakpoint';
import { onMounted } from 'vue';
import { panelViewItemResponsive } from "@/helpers/utils";
import { getBreakpointValue } from "@/plugins/breakpoint";
import { onMounted } from "vue";
onMounted(() => {
document.documentElement.style.setProperty(
'--swiper-navigation-color',
'primary',
"--swiper-navigation-color",
"primary",
);
});
</script>
6 changes: 3 additions & 3 deletions src/components/FavoriteButton.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { type MediaItemType } from '@/plugins/api/interfaces';
import api from '@/plugins/api';
import Button from '@/components/mods/Button.vue';
import { type MediaItemType } from "@/plugins/api/interfaces";
import api from "@/plugins/api";
import Button from "@/components/mods/Button.vue";
interface Props {
item: MediaItemType;
Expand Down
14 changes: 7 additions & 7 deletions src/components/HomeCurrentlyPlayingRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<v-toolbar class="header" color="transparent" style="width: fit-content">
<template #prepend><v-icon icon="mdi-play-circle-outline" /></template>
<template #title>
<span class="mr-3">{{ $t('currently_playing') }}</span>
<span class="mr-3">{{ $t("currently_playing") }}</span>
</template>
</v-toolbar>
<swiper>
Expand All @@ -24,11 +24,11 @@
</template>

<script setup lang="ts">
import { computed } from 'vue';
import { PlayerState, Player } from '@/plugins/api/interfaces';
import api from '@/plugins/api';
import { store } from '@/plugins/store';
import PanelviewPlayerCard from '@/components/PanelviewPlayerCard.vue';
import { computed } from "vue";
import { PlayerState, Player } from "@/plugins/api/interfaces";
import api from "@/plugins/api";
import { store } from "@/plugins/store";
import PanelviewPlayerCard from "@/components/PanelviewPlayerCard.vue";

const playerStateOrder = {
[PlayerState.PLAYING]: 1,
Expand Down Expand Up @@ -65,7 +65,7 @@ function playerClicked(player: Player) {
<style scoped>
.header.v-toolbar {
height: 55px;
font-family: 'JetBrains Mono Medium';
font-family: "JetBrains Mono Medium";
}

.home-card {
Expand Down
20 changes: 10 additions & 10 deletions src/components/HomeWidgetRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@
</template>

<script setup lang="ts">
import Carousel from '@/components/Carousel.vue';
import PanelviewItemCompact from '@/components/PanelviewItemCompact.vue';
import { showContextMenuForMediaItem } from '@/layouts/default/ItemContextMenu.vue';
import api from '@/plugins/api';
import { itemIsAvailable } from '@/plugins/api/helpers';
import Carousel from "@/components/Carousel.vue";
import PanelviewItemCompact from "@/components/PanelviewItemCompact.vue";
import { showContextMenuForMediaItem } from "@/layouts/default/ItemContextMenu.vue";
import api from "@/plugins/api";
import { itemIsAvailable } from "@/plugins/api/helpers";
import {
BrowseFolder,
MediaItemType,
MediaType,
PlayerQueue,
} from '@/plugins/api/interfaces';
import router from '@/plugins/router';
import { store } from '@/plugins/store';
} from "@/plugins/api/interfaces";
import router from "@/plugins/router";
import { store } from "@/plugins/store";
export interface WidgetRow {
label: string;
Expand Down Expand Up @@ -91,7 +91,7 @@ const onClick = function (item: MediaItemType, posX: number, posY: number) {
}
if (item.media_type == MediaType.FOLDER) {
router.push({
name: 'browse',
name: "browse",
query: {
path: (item as BrowseFolder).path,
},
Expand Down Expand Up @@ -124,7 +124,7 @@ const onPlayClick = function (item: MediaItemType, posX: number, posY: number) {
<style scoped>
.header.v-toolbar {
height: 55px;
font-family: 'JetBrains Mono Medium';
font-family: "JetBrains Mono Medium";
}
.widget-row {
Expand Down
Loading

0 comments on commit afc1990

Please sign in to comment.