Skip to content

Commit

Permalink
feat: darkmode
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricerenck committed Jan 23, 2025
1 parent e4148be commit f5cde1f
Show file tree
Hide file tree
Showing 12 changed files with 1,009 additions and 8,866 deletions.
13 changes: 1 addition & 12 deletions index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9,234 changes: 679 additions & 8,555 deletions index.js

Large diffs are not rendered by default.

39 changes: 30 additions & 9 deletions panel-src/components/Analytics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<k-view class="k-podcaster-view">
<k-header>Podcaster Analytics</k-header>

<k-grid gutter="small">
<k-grid style="gap: var(--spacing-6)">
<k-column width="1/4">
<k-select-field
v-model="selectedPodcast"
Expand Down Expand Up @@ -43,14 +43,17 @@
:selectedMonth="this.selectedMonth"
:selectedYear="this.selectedYear"
:selectedPodcast="this.selectedPodcast"
:themeMode="this.apexMode()"
/>
</k-column>

</k-grid>
<k-grid class="podcaster podcaster-graph" style="gap: var(--spacing-6)">
<k-column width="1/3">
<PodGraphDevices
:selectedMonth="this.selectedMonth"
:selectedYear="this.selectedYear"
:selectedPodcast="this.selectedPodcast"
:themeMode="this.apexMode()"
/>
</k-column>

Expand All @@ -59,6 +62,7 @@
:selectedMonth="this.selectedMonth"
:selectedYear="this.selectedYear"
:selectedPodcast="this.selectedPodcast"
:themeMode="this.apexMode()"
/>
</k-column>

Expand All @@ -67,18 +71,20 @@
:selectedMonth="this.selectedMonth"
:selectedYear="this.selectedYear"
:selectedPodcast="this.selectedPodcast"
:themeMode="this.apexMode()"
/>
</k-column>

</k-grid>
<k-grid style="gap: var(--spacing-6)">
<k-column>
<k-line-field />
<k-headline size="huge">Episode Details</k-headline>
</k-column>

<k-column width="2/3">
<PodGraphSingleEpisode
:selectedPodcast="this.selectedPodcast"
:selectedEpisodes="this.selectedEpisodes"
:themeMode="this.apexMode()"
/>
</k-column>

Expand All @@ -88,24 +94,24 @@
:selectedEpisodes="this.selectedEpisodes"
:onSelectEpisode="this.addSelectedEpisode"
:onRemoveEpisode="this.removeSelectedEpisode"
:themeMode="this.apexMode()"
/>

<k-headline>Top10 Episodes</k-headline>
<PodTopEpisodes
:selectedPodcast="this.selectedPodcast"
:onSelectEpisode="this.addSelectedEpisode"
:themeMode="this.apexMode()"
/>
</k-column>

<k-column width="1/1">
<k-line-field />
<k-headline size="huge">Episode Downloads</k-headline>
<PodGraphEpisodes :selectedPodcast="this.selectedPodcast" />
<PodGraphEpisodes :selectedPodcast="this.selectedPodcast" :themeMode="this.apexMode()" />
</k-column>
<k-column width="1/1">
<k-line-field />
<k-headline size="huge">Feed Downloads</k-headline>
<PodGraphFeeds :selectedPodcast="this.selectedPodcast" />
<PodGraphFeeds :selectedPodcast="this.selectedPodcast" :themeMode="this.apexMode()" />
</k-column>
</k-grid>
</k-view>
Expand Down Expand Up @@ -171,8 +177,23 @@ export default {
return episode !== value
})
},
apexMode() {
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
},
},
}
</script>

<style lang="scss"></style>
<style lang="css">
.podcaster-graph {
background: var(--color-white);
border-radius: var(--rounded-md);
padding: var(--spacing-6);
margin: var(--spacing-6) 0;
}
@media (prefers-color-scheme: dark) {
.podcaster-graph {
background-color: rgb(66, 66, 66); /* apexchart dark theme */
}
}
</style>
4 changes: 2 additions & 2 deletions panel-src/components/EpisodesAutocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ export default {
.podcaster-auto-complete {
width: 100%;
border: 0;
border: 1px solid var(--border-color);
border: 1px solid var(--color-gray-500);
padding: var(--field-input-padding);
line-height: var(--field-input-line-height);
border-radius: var(--rounded);
border-radius: var(--rounded-md);
}
.episode-selection {
Expand Down
107 changes: 52 additions & 55 deletions panel-src/components/GraphDevicesMonth.vue
Original file line number Diff line number Diff line change
@@ -1,70 +1,67 @@
<template>
<section class="k-modified-section podcaster">
<apexchart height="300" :options="options" :series="series"></apexchart>
</section>
<section class="k-modified-section podcaster">
<apexchart height="300" :options="options" :series="series"></apexchart>
</section>
</template>
<script>
import VueApexCharts from 'vue-apexcharts'
export default {
components: {'apexchart': VueApexCharts},
props: {
selectedMonth: Number,
selectedYear: Number,
selectedPodcast: String,
},
data() {
return {
options: {
chart: {
id: 'devices-month',
type: 'pie'
},
theme: {
palette: 'palette3'
},
},
components: { apexchart: VueApexCharts },
props: {
selectedMonth: Number,
selectedYear: Number,
selectedPodcast: String,
themeMode: String,
},
data() {
return {
options: {
chart: {
id: 'devices-month',
type: 'pie',
},
theme: { mode: this.themeMode, palette: 'palette3' },
},
series: []
}
},
watch: {
selectedMonth() {
this.getDeviceGraphData();
series: [],
}
},
selectedYear() {
this.getDeviceGraphData();
watch: {
selectedMonth() {
this.getDeviceGraphData()
},
selectedYear() {
this.getDeviceGraphData()
},
selectedPodcast() {
this.getDeviceGraphData()
},
},
selectedPodcast() {
this.getDeviceGraphData();
}
},
methods: {
getDeviceGraphData() {
this.$api
.get(`podcaster/stats/graph/devices/${this.selectedPodcast}/${this.selectedYear}/${this.selectedMonth}`)
.then((response) => {
if (!response) {
return
}
methods: {
getDeviceGraphData() {
this.$api
.get(`podcaster/stats/graph/devices/${this.selectedPodcast}/${this.selectedYear}/${this.selectedMonth}`)
.then((response) => {
if (!response) {
return
}
const devices = []
const labels = []
const devices = []
const labels = []
response.data.forEach(device => {
devices.push(100/response.total * device.downloads)
labels.push(device.device)
})
response.data.forEach((device) => {
devices.push((100 / response.total) * device.downloads)
labels.push(device.device)
})
this.series = devices
this.options = {...this.options, ...{labels: labels}}
})
this.series = devices
this.options = { ...this.options, ...{ labels: labels } }
})
},
},
created() {
this.getDeviceGraphData()
},
},
created() {
this.getDeviceGraphData();
},
}
</script>
106 changes: 56 additions & 50 deletions panel-src/components/GraphDownloadsMonth.vue
Original file line number Diff line number Diff line change
@@ -1,64 +1,70 @@
<template>
<section class="k-modified-section podcaster">
<apexchart height="300" type="bar" :options="options" :series="series"></apexchart>
</section>
<section class="k-modified-section podcaster podcaster-graph">
<apexchart height="300" type="bar" :options="options" :series="series"></apexchart>
</section>
</template>
<script>
import VueApexCharts from 'vue-apexcharts'
export default {
components: {'apexchart': VueApexCharts},
props: {
selectedMonth: Number,
selectedYear: Number,
selectedPodcast: String,
},
data() {
return {
options: {
chart: {
id: 'downloads-month'
components: { apexchart: VueApexCharts },
props: {
selectedMonth: Number,
selectedYear: Number,
selectedPodcast: String,
themeMode: String,
},
data() {
return {
options: {
chart: {
id: 'downloads-month',
},
yaxis: {
labels: {
formatter: function (val) {
return val.toFixed(0)
},
},
},
theme: {
mode: this.themeMode,
palette: 'palette3',
},
xaxis: {
categories: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31,
],
},
},
series: [],
}
},
watch: {
selectedMonth() {
this.getEpisodeGraphData()
},
yaxis: {
labels: {
formatter: function (val) {
return val.toFixed(0);
}
}
selectedYear() {
this.getEpisodeGraphData()
},
theme: {
palette: 'palette3'
selectedPodcast() {
this.getEpisodeGraphData()
},
xaxis: {
categories: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
}
},
series: []
}
},
watch: {
selectedMonth() {
this.getEpisodeGraphData();
},
selectedYear() {
this.getEpisodeGraphData();
methods: {
getEpisodeGraphData() {
this.$api
.get(
`podcaster/stats/graph/downloads/${this.selectedPodcast}/${this.selectedYear}/${this.selectedMonth}`
)
.then((response) => {
this.series = [{ name: 'downloads', data: response.days.slice(1) }]
})
},
},
selectedPodcast() {
this.getEpisodeGraphData();
}
},
methods: {
getEpisodeGraphData() {
this.$api
.get(`podcaster/stats/graph/downloads/${this.selectedPodcast}/${this.selectedYear}/${this.selectedMonth}`)
.then((response) => {
this.series = [{name: 'downloads', data: response.days.slice(1)}]
})
created() {
this.getEpisodeGraphData()
},
},
created() {
this.getEpisodeGraphData();
},
}
</script>
Loading

0 comments on commit f5cde1f

Please sign in to comment.