2020-10-17 18:06:57 +00:00
|
|
|
<template>
|
2020-10-19 19:23:26 +00:00
|
|
|
<table v-if="stationData" id="table">
|
2020-10-17 18:06:57 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2020-10-21 08:31:59 +00:00
|
|
|
<th class="iconColumn" />
|
2020-10-17 18:06:57 +00:00
|
|
|
<th class="nameColumn">
|
2020-10-18 09:49:17 +00:00
|
|
|
{{ t('radio', 'Name') }}
|
2020-10-17 18:06:57 +00:00
|
|
|
</th>
|
2020-10-21 08:31:59 +00:00
|
|
|
<th class="actionColumn" />
|
2020-10-17 18:06:57 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
2020-10-19 19:23:26 +00:00
|
|
|
<tbody>
|
2020-10-19 18:06:07 +00:00
|
|
|
<tr
|
|
|
|
v-for="(station, idx) in stationData"
|
|
|
|
:key="idx"
|
|
|
|
:class="{ selected: idx === activeItem}">
|
2020-10-20 13:09:30 +00:00
|
|
|
<td @click="doPlay(idx, station)">
|
2020-10-17 18:06:57 +00:00
|
|
|
<div class="stationIcon"
|
2020-10-19 19:23:26 +00:00
|
|
|
:style="{ backgroundImage: `url('${ station.favicon }')` }">
|
2020-10-20 13:09:30 +00:00
|
|
|
<span :class="{ 'icon-starred': stationsFavored.includes(idx) }" />
|
2020-10-19 19:23:26 +00:00
|
|
|
</div>
|
2020-10-17 18:06:57 +00:00
|
|
|
</td>
|
2020-10-21 08:31:59 +00:00
|
|
|
<td class="nameColumn" @click="doPlay(idx, station)">
|
2020-10-17 18:06:57 +00:00
|
|
|
<span class="innernametext">
|
|
|
|
{{ station.name }}
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
<td class="actionColumn">
|
|
|
|
<Actions>
|
2020-10-19 19:23:26 +00:00
|
|
|
<ActionButton icon="icon-star" :close-after-click="true" @click="doFavor(idx, station)">
|
2020-10-18 09:49:17 +00:00
|
|
|
{{ t('radio', 'Add to favorites') }}
|
2020-10-17 18:06:57 +00:00
|
|
|
</ActionButton>
|
|
|
|
<ActionButton icon="icon-info" :close-after-click="true">
|
2020-10-18 09:49:17 +00:00
|
|
|
{{ t('radio', 'Details') }}
|
2020-10-17 18:06:57 +00:00
|
|
|
</ActionButton>
|
|
|
|
</Actions>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Actions from '@nextcloud/vue/dist/Components/Actions'
|
|
|
|
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Table',
|
|
|
|
components: {
|
|
|
|
Actions,
|
|
|
|
ActionButton,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
stationData: {
|
|
|
|
type: Array,
|
|
|
|
default() { return [] },
|
|
|
|
},
|
|
|
|
},
|
2020-10-22 11:53:40 +00:00
|
|
|
data: () => ({
|
|
|
|
activeItem: null,
|
|
|
|
stationsFavored: [1, 2],
|
|
|
|
}),
|
2020-10-18 09:38:10 +00:00
|
|
|
methods: {
|
2020-10-19 18:06:07 +00:00
|
|
|
doPlay(idx, station) {
|
|
|
|
this.activeItem = idx
|
2020-10-18 09:38:10 +00:00
|
|
|
this.$emit('doPlay', station)
|
|
|
|
},
|
2020-10-19 19:23:26 +00:00
|
|
|
doFavor(idx, station) {
|
|
|
|
this.$emit('doFavor', station)
|
|
|
|
},
|
2020-10-18 09:38:10 +00:00
|
|
|
},
|
2020-10-17 18:06:57 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
|
|
table {
|
|
|
|
width: 100%;
|
|
|
|
min-width: 250px;
|
2020-10-21 08:05:18 +00:00
|
|
|
table-layout:fixed;
|
2020-10-17 18:06:57 +00:00
|
|
|
|
|
|
|
thead {
|
|
|
|
background-color: var(--color-main-background-translucent);
|
|
|
|
z-index: 60;
|
|
|
|
position: sticky;
|
|
|
|
position: -webkit-sticky;
|
|
|
|
top: 99px;
|
|
|
|
|
|
|
|
th {
|
|
|
|
border-bottom: 1px solid var(--color-border);
|
|
|
|
padding: 15px;
|
|
|
|
height: 50px;
|
|
|
|
}
|
|
|
|
|
|
|
|
th, th a {
|
|
|
|
color: var(--color-text-maxcontrast);
|
|
|
|
}
|
|
|
|
|
2020-10-21 08:31:59 +00:00
|
|
|
th.iconColumn {
|
|
|
|
padding: 0px;
|
|
|
|
width: 72px;
|
|
|
|
}
|
|
|
|
|
2020-10-17 18:06:57 +00:00
|
|
|
th.nameColumn {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
2020-10-21 08:31:59 +00:00
|
|
|
th.actionColumn {
|
2020-10-21 08:02:38 +00:00
|
|
|
width: 72px;
|
|
|
|
}
|
|
|
|
|
2020-10-17 18:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tbody {
|
|
|
|
|
|
|
|
td {
|
|
|
|
padding: 0 15px;
|
|
|
|
font-style: normal;
|
|
|
|
background-position: 8px center;
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
border-bottom: 1px solid var(--color-border);
|
2020-10-19 19:23:26 +00:00
|
|
|
cursor: pointer;
|
2020-10-17 18:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tr {
|
|
|
|
height: 51px;
|
|
|
|
background-color: var(--color-background-light);
|
|
|
|
|
|
|
|
tr:hover, tr:focus, tr.mouseOver td {
|
|
|
|
background-color: var(--color-background-hover);
|
|
|
|
}
|
|
|
|
|
2020-10-20 13:03:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tr.selected {
|
|
|
|
background-color: var(--color-primary-light);
|
2020-10-19 18:06:07 +00:00
|
|
|
}
|
|
|
|
|
2020-10-17 18:06:57 +00:00
|
|
|
tr td:first-child {
|
|
|
|
padding-left: 40px;
|
|
|
|
width: 32px;
|
|
|
|
padding-right: 0px;
|
|
|
|
}
|
|
|
|
|
2020-10-21 08:31:59 +00:00
|
|
|
td.nameColumn .innernametext {
|
2020-10-17 18:06:57 +00:00
|
|
|
color: var(--color-main-text);
|
2020-10-18 09:38:10 +00:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
vertical-align: top;
|
|
|
|
user-select: none;
|
2020-10-19 19:23:26 +00:00
|
|
|
cursor: pointer;
|
2020-10-17 18:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.stationIcon {
|
|
|
|
width: 32px;
|
|
|
|
height: 32px;
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
background-size: contain;
|
|
|
|
background-position: center;
|
2020-10-20 13:03:20 +00:00
|
|
|
cursor: pointer;
|
2020-10-17 18:06:57 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 19:23:26 +00:00
|
|
|
.icon-starred {
|
|
|
|
background-image: var(--icon-star-dark-fc0);
|
|
|
|
vertical-align: middle;
|
|
|
|
background-size: 16px 16px;
|
|
|
|
display: inline-block;
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
background-position: center;
|
|
|
|
min-width: 16px;
|
|
|
|
min-height: 16px;
|
2020-10-20 13:03:20 +00:00
|
|
|
cursor: pointer;
|
|
|
|
pointer-events: none;
|
|
|
|
right: -7px;
|
|
|
|
top: -7px;
|
|
|
|
float: right;
|
|
|
|
position: relative;
|
2020-10-19 19:23:26 +00:00
|
|
|
}
|
|
|
|
|
2020-10-17 18:06:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|