UX: Find all media types via /browse by default #859

This commit is contained in:
Michael Mayer 2021-01-11 14:06:48 +01:00
parent 601a563248
commit 0a6d9fc376
5 changed files with 26 additions and 21 deletions

View file

@ -126,6 +126,14 @@ export default class Config {
const type = ev.split(".")[1];
switch (type) {
case "photos":
this.values.count.all += data.count;
this.values.count.photos += data.count;
break;
case "videos":
this.values.count.all += data.count;
this.values.count.videos += data.count;
break;
case "cameras":
this.values.count.cameras += data.count;
this.update();
@ -146,9 +154,6 @@ export default class Config {
case "labels":
this.values.count.labels += data.count;
break;
case "videos":
this.values.count.videos += data.count;
break;
case "albums":
this.values.count.albums += data.count;
break;
@ -173,9 +178,6 @@ export default class Config {
case "private":
this.values.count.private += data.count;
break;
case "photos":
this.values.count.photos += data.count;
break;
default:
console.warn("unknown count type", ev, data);
}

View file

@ -59,24 +59,24 @@
</v-list-tile-action>
</v-list-tile>
<v-list-tile v-if="isMini" to="/photos" class="nav-photos" @click.stop="">
<v-list-tile v-if="isMini" to="/browse" class="nav-browse" @click.stop="">
<v-list-tile-action :title="$gettext('Photos')">
<v-icon>photo</v-icon>
<v-icon>image_search</v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>
<translate>Photos</translate>
<translate>Search</translate>
</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
<v-list-group v-if="!isMini" prepend-icon="photo" no-action>
<v-list-tile slot="activator" to="/photos" class="nav-photos" @click.stop="">
<v-list-group v-if="!isMini" prepend-icon="image_search" no-action>
<v-list-tile slot="activator" to="/browse" class="nav-browse" @click.stop="">
<v-list-tile-content>
<v-list-tile-title>
<translate key="Photos">Photos</translate>
<span v-if="config.count.photos > 0" :class="`nav-count ${rtl ? '--rtl' : ''}`">{{ config.count.photos }}</span>
<translate key="Search">Search</translate>
<span v-if="config.count.all > 0" :class="`nav-count ${rtl ? '--rtl' : ''}`">{{ config.count.all }}</span>
</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>

View file

@ -52,7 +52,7 @@ export default [
{
name: "home",
path: "/",
redirect: "/photos",
redirect: "/browse",
},
{
name: "about",
@ -360,6 +360,6 @@ export default [
},
{
path: "*",
redirect: "/photos",
redirect: "/browse",
},
];

View file

@ -65,11 +65,12 @@ type ClientDisable struct {
// ClientCounts represents photo, video and album counts for the client UI.
type ClientCounts struct {
All int `json:"all"`
Photos int `json:"photos"`
Videos int `json:"videos"`
Cameras int `json:"cameras"`
Lenses int `json:"lenses"`
Countries int `json:"countries"`
Photos int `json:"photos"`
Videos int `json:"videos"`
Hidden int `json:"hidden"`
Favorites int `json:"favorites"`
Private int `json:"private"`
@ -303,6 +304,8 @@ func (c *Config) UserConfig() ClientConfig {
Where("deleted_at IS NULL").
Take(&result.Count)
result.Count.All = result.Count.Photos + result.Count.Videos
c.Db().
Table("labels").
Select("MAX(photo_count) as label_max_photos, COUNT(*) AS labels").

View file

@ -639,10 +639,6 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) (
return result
}
event.Publish("count.photos", event.Data{
"count": 1,
})
if photo.PhotoPrivate {
event.Publish("count.private", event.Data{
"count": 1,
@ -653,6 +649,10 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) (
event.Publish("count.videos", event.Data{
"count": 1,
})
} else {
event.Publish("count.photos", event.Data{
"count": 1,
})
}
event.EntitiesCreated("photos", []entity.Photo{photo})