Skip to content

Commit

Permalink
Clean source code
Browse files Browse the repository at this point in the history
  • Loading branch information
tijder committed Apr 23, 2024
1 parent 3ac4d54 commit 32c44f0
Show file tree
Hide file tree
Showing 16 changed files with 164 additions and 164 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
node_modules
openapi-generator-cli.jar
/dist

# local env files
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:lts-alpine as build-stage
FROM node:lts-alpine AS build-stage

# make the 'app' folder the current working directory
WORKDIR /app
Expand All @@ -7,7 +7,7 @@ WORKDIR /app
COPY package*.json ./

# install project dependencies
RUN npm install
RUN npm ci

# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .
Expand All @@ -16,7 +16,7 @@ COPY . .
RUN npm run build

# production stage
FROM nginx:stable-alpine as production-stage
FROM nginx:stable-alpine AS production-stage

COPY --from=build-stage /app/dist /usr/share/nginx/html

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">

<head>
<meta charset="UTF-8" />
Expand Down
256 changes: 128 additions & 128 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ sonar.organization=ister-app


# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.
sonar.sources=src/
sonar.exclusions=src/generated-sources/

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
2 changes: 1 addition & 1 deletion src/components/EpisodeList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ watch(props, () => {
})
const goTo = useGoTo()
const selected: Ref<Array<String>> = ref([]);
const selected: Ref<Array<string>> = ref([]);
function getProgressInPercent(watchStatus: { progressInMilliseconds: number }[] | undefined | null, mediaFile: {
durationInMilliseconds?: number | undefined | null
Expand Down
5 changes: 2 additions & 3 deletions src/components/Player.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ const state = reactive({
const apiService = useApiService();
const root = ref()
const controllsVisable: Ref<Boolean> = ref(true);
var showControllsTimeout: number | undefined;
const controllsVisable: Ref<boolean> = ref(true);
let showControllsTimeout: number | undefined;
const video: Ref<HTMLVideoElement | undefined> = ref();
const startedPlaying = ref(false);
Expand Down Expand Up @@ -214,7 +214,6 @@ function playPause() {
function goToTime() {
stop();
// video.value.currentTime = (progres.value * durationTime.value / 100) - offsetTime.value;
offsetTime.value = Math.round(progress.value * durationTime.value / 100);
startPlaying();
}
Expand Down
16 changes: 12 additions & 4 deletions src/components/Recentcarousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
class="align-end"
cover gradient="to bottom, rgba(0,0,0,.1), rgba(0,0,0,.8)" height="450px">
<v-card-text class="text-white">
<p class="text-h5">{{ MetadataUtilService.getMetadataFieldForLanguage('title', episodes.show!.metadata, $t("iso-639-3")) }}</p>
s{{ episodes.season?.number }}e{{ episodes.number }} {{ MetadataUtilService.getMetadataFieldForLanguage('title', episodes.metadata, $t("iso-639-3")) }}
<p class="text-h5">{{
MetadataUtilService.getMetadataFieldForLanguage('title', episodes.show!.metadata, $t("iso-639-3"))
}}</p>
s{{ episodes.season?.number }}e{{ episodes.number }} {{
MetadataUtilService.getMetadataFieldForLanguage('title', episodes.metadata, $t("iso-639-3"))
}}
</v-card-text>
</Image>
</v-card>
Expand All @@ -32,10 +36,14 @@
<v-container class="pa-0 ma-0">
<v-row class="flex-nowrap">
<v-col class="flex-grow-1 flex-shrink-1 text-truncate">
<v-card-title class="text-h5">{{ MetadataUtilService.getMetadataFieldForLanguage('title', episodeEntity.show?.metadata, $t("iso-639-3")) }}</v-card-title>
<v-card-title class="text-h5">{{
MetadataUtilService.getMetadataFieldForLanguage('title', episodeEntity.show?.metadata, $t("iso-639-3"))
}}</v-card-title>
<v-card-subtitle>s{{
episodeEntity.season?.number
}}e{{ episodeEntity.number }} {{ MetadataUtilService.getMetadataFieldForLanguage('title', episodeEntity.metadata, $t("iso-639-3")) }}
}}e{{ episodeEntity.number }} {{
MetadataUtilService.getMetadataFieldForLanguage('title', episodeEntity.metadata, $t("iso-639-3"))
}}
</v-card-subtitle>
</v-col>
<v-col class="flex-grow-0 flex-shrink-0">
Expand Down
7 changes: 3 additions & 4 deletions src/components/TVShowsSeasonExpansion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

<script lang="ts" setup>
import {Ref, watch} from 'vue'
import {ref} from 'vue'
import {Ref, ref, watch} from 'vue'
import {useQuery} from "@urql/vue";
import {graphql} from "@/generated-sources/gql";
import {ShowByIdSeasonsQuery} from "@/generated-sources/gql/graphql";
Expand All @@ -29,7 +28,7 @@ const props = defineProps<{
selectedSeasonId?: string
}>()
const selected: Ref<String | undefined> = ref();
const selected: Ref<string | undefined> = ref();
const fetching: Ref<boolean | undefined> = ref(true);
const error: Ref<any | undefined> = ref();
Expand All @@ -46,7 +45,7 @@ watch(props, () => {
})
useQuery({
variables: { id },
variables: {id},
query: graphql(`
query showByIdSeasons($id: ID!) {
showById(id: $id) {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/shows/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import {graphql} from "@/generated-sources/gql";
const route = useRoute("/shows/[id]/");
const selectedEpisodeId: Ref<String | undefined> = ref();
const selectedSeasonId: Ref<String | undefined> = ref();
const selectedEpisodeId: Ref<string | undefined> = ref();
const selectedSeasonId: Ref<string | undefined> = ref();
const id = route.params.id;
Expand Down
3 changes: 1 addition & 2 deletions src/pages/shows/[id]/episodes.[episodeId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</template>

<script lang="ts" setup>
import {computed, Ref, ref, watch} from 'vue'
import {computed, watch} from 'vue'
import {useRoute} from 'vue-router/auto';
import {useQuery} from "@urql/vue";
import {graphql} from "@/generated-sources/gql";
Expand All @@ -22,7 +22,6 @@ const emit = defineEmits<{
const route = useRoute("/shows/[id]/episodes.[episodeId]");
// const id: Ref<string> = ref(route.params.episodeId);
const id = computed(() => route.params.episodeId);
const shouldPause = computed(() => route.params.episodeId == null);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/shows/[id]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<script lang="ts" setup>
import MetadataUtilService from "@/services/metadataUtil.service";
import {Episode, Show} from "@/generated-sources/gql/graphql";
import {Show} from "@/generated-sources/gql/graphql";
defineProps<{
show: Show | undefined,
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import {AuthConfig, authExchange} from "@urql/exchange-auth";
function initializeAuthState() {
const tokenJson = sessionStorage.getItem('oidc.user:https://keycloak.droogers.cloud/realms/Thuis:ister');
const token = tokenJson ? JSON.parse(tokenJson).access_token : undefined;
// const refreshToken = localStorage.getItem('refreshToken');
console.log(token);
return { token };
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class AuthService {
return this.userManager.getUser();
}

async getToken(): Promise<String | undefined> {
async getToken(): Promise<string | undefined> {
const user = await this.getUser();
return user?.access_token;
}
Expand Down
6 changes: 3 additions & 3 deletions src/services/imageUtil.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface Image {
language?: string | null | undefined;
language: string | null | undefined;
id: string;
type: string;
}
Expand All @@ -8,7 +8,7 @@ export default class ImageUtilService {
public static getCoverImageId(imageEntities: Image[]): string {
const imageEntitiesCover = imageEntities.filter((image) => image.type === "COVER");
if (imageEntitiesCover.length !== 0) {
return imageEntitiesCover[0].id!.toString();
return imageEntitiesCover[0].id.toString();
} else {
return '';
}
Expand All @@ -17,7 +17,7 @@ export default class ImageUtilService {
public static getBackgroundImageId(imageEntities: Image[]): string {
const imageEntitiesCover = imageEntities.filter((image) => image.type === "BACKGROUND");
if (imageEntitiesCover.length !== 0) {
return imageEntitiesCover[0].id!.toString();
return imageEntitiesCover[0].id.toString();
} else {
return '';
}
Expand Down
11 changes: 3 additions & 8 deletions src/services/metadataUtil.service.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import {EpisodeEntity, SeasonEntity, ShowEntity} from "@/generated-sources/openapi";


export interface Metadata {
language?: string | null | undefined;
title?: string | null | undefined;
}
import {Maybe} from "graphql/jsutils/Maybe";
import {Metadata} from "@/generated-sources/gql/graphql";

/**
* This util helps with getting the correct value for the given language.
* If the given language doesn't exist return english then the not set language.
*/
export default class MetadataUtilService {
public static getMetadataFieldForLanguage(field: string, metadataEntities: Metadata[] | null | undefined, preferredLanguage: String | undefined): string | undefined | Date | ShowEntity | SeasonEntity | EpisodeEntity {
public static getMetadataFieldForLanguage(field: string, metadataEntities: Maybe<Array<Metadata>> | undefined, preferredLanguage: string | undefined): string | Date | undefined {
if (metadataEntities === undefined || metadataEntities === null) {
return "";
} else {
Expand Down

0 comments on commit 32c44f0

Please sign in to comment.