add project info to project list

This commit is contained in:
Jake Potrebic 2021-06-06 21:19:06 -07:00
parent 40b2ff023e
commit 2da8420449
No known key found for this signature in database
GPG Key ID: 7C58557EC9C421F8
4 changed files with 31 additions and 4 deletions

View File

@ -24,6 +24,25 @@
<br />
<span class="text-subtitle-2">{{ project.description }}</span>
</div>
<div class="flex-grow-1 mr-2 mt-1">
<div class="text--secondary text-right body-1">
<span :title="$tc('project.info.views', project.stats.views, [project.stats.views])">
<v-icon small>mdi-eye</v-icon>
{{ project.stats.views }}
</span>
<span :title="$tc('project.info.totalDownloads', project.stats.downloads, [project.stats.downloads])">
<v-icon small class="ml-1">mdi-download</v-icon>
{{ project.stats.downloads }}
</span>
<span :title="$tc('project.info.stars', project.stats.stars, [project.stats.stars])">
<v-icon small class="ml-1">mdi-star</v-icon>
{{ project.stats.stars }}
</span>
<v-icon small class="ml-3" :title="$store.state.projectCategories.get(project.category).title">{{
$store.state.projectCategories.get(project.category).icon
}}</v-icon>
</div>
</div>
</v-row>
</v-sheet>
</NuxtLink>

View File

@ -1,6 +1,7 @@
package io.papermc.hangar.model.db.versions;
import io.papermc.hangar.model.Named;
import io.papermc.hangar.model.common.Platform;
import io.papermc.hangar.model.common.TagColor;
import io.papermc.hangar.model.db.Table;
import org.jdbi.v3.core.enums.EnumByOrdinal;
@ -25,10 +26,17 @@ public class ProjectVersionTagTable extends Table implements Named {
this.color = color;
}
public ProjectVersionTagTable(long versionId, String name, Set<String> data, TagColor color) {
public ProjectVersionTagTable(long versionId, Platform platform, Set<String> data) {
this.versionId = versionId;
this.name = platform.getName();
this.data = data;
this.color = platform.getTagColor();
}
public ProjectVersionTagTable(long versionId, String name, TagColor color) {
this.versionId = versionId;
this.name = name;
this.data = data;
this.data = null;
this.color = color;
}

View File

@ -218,7 +218,7 @@ public class VersionFactory extends HangarComponent {
List<ProjectVersionTagTable> projectVersionTagTables = new ArrayList<>();
List<ProjectVersionPlatformDependencyTable> platformDependencyTables = new ArrayList<>();
for (var entry : pendingVersion.getPlatformDependencies().entrySet()) {
projectVersionTagTables.add(new ProjectVersionTagTable(projectVersionTable.getId(), entry.getKey().getName(), entry.getValue(), entry.getKey().getTagColor()));
projectVersionTagTables.add(new ProjectVersionTagTable(projectVersionTable.getId(), entry.getKey(), entry.getValue()));
for (String version : entry.getValue()) {
PlatformVersionTable platformVersionTable = platformVersionDAO.getByPlatformAndVersion(entry.getKey(), version);
platformDependencyTables.add(new ProjectVersionPlatformDependencyTable(projectVersionTable.getId(), platformVersionTable.getId()));

View File

@ -35,6 +35,6 @@ public class VersionTagService extends HangarComponent {
}
public void addUnstableTag(long versionId) {
addTags(new ProjectVersionTagTable(versionId, "Unstable", null, TagColor.UNSTABLE));
addTags(new ProjectVersionTagTable(versionId, "Unstable", TagColor.UNSTABLE));
}
}