feat: display all projects when no skill is selected

This commit is contained in:
Adrien Marquès 2022-10-19 17:24:58 +02:00
parent d2f9e5632f
commit c6217babc4
Signed by: xdrm-brackets
GPG Key ID: D75243CA236D825E
5 changed files with 30 additions and 19 deletions

View File

@ -39,6 +39,7 @@
</div> </div>
<input type='button' v-show='this.sel != null' :value="$t('skills.browse')" @click='browse()'/> <input type='button' v-show='this.sel != null' :value="$t('skills.browse')" @click='browse()'/>
<input type='button' v-show='this.sel == null' :value="$t('skills.browse-all')" @click='browse()'/>
</div> </div>
<div class='spacer'></div> <div class='spacer'></div>
@ -74,7 +75,7 @@ export default class SkillPicker extends Vue {
// list of available skills // list of available skills
public readonly ids: tID[] = skills.available(); public readonly ids: tID[] = skills.available();
// currently selected skill // currently selected skill
private sel: tID|null = tID.Vue; private sel: tID|null = null;
// list of ids to display according to the current tag // list of ids to display according to the current tag
private filtered: tID[] = []; private filtered: tID[] = [];

View File

@ -4,7 +4,7 @@
<div id='search-header' ref='header'> <div id='search-header' ref='header'>
<img src='../assets/timeline/logo.svg'/> <img src='../assets/timeline/logo.svg'/>
<span> <span>
<h3>{{ $t('timeline.title') }}</h3> <SkillCard :id='skill' :active='true'/> <h3>{{ $t( (skill == null) ? 'timeline.title-all' : 'timeline.title') }}</h3> <SkillCard v-show='skill != null' :id='skill' :active='true'/>
</span> </span>
<input type='button' :value="$t('timeline.back')" @click='$event.preventDefault(); scrollBack()'/> <input type='button' :value="$t('timeline.back')" @click='$event.preventDefault(); scrollBack()'/>
</div> </div>
@ -137,14 +137,7 @@ export default class Timeline extends Vue {
private skill: tID|null = null; private skill: tID|null = null;
private projects: Project[] = []; private projects: Project[] = [];
private sort_projects(a: Project, b: Project): number {
public filter(skill: tID|null) {
this.skill = skill;
if ( skill == null ) {
this.projects = [];
return;
}
this.projects = projects.bySkill(skill).sort( (a, b) => {
if ( b.stopped_at == null && a.stopped_at == null ) { if ( b.stopped_at == null && a.stopped_at == null ) {
return b.started_at.getTime() - a.started_at.getTime(); return b.started_at.getTime() - a.started_at.getTime();
} }
@ -155,7 +148,16 @@ export default class Timeline extends Vue {
return -1; return -1;
} }
return b.started_at.getTime() - a.started_at.getTime(); return b.started_at.getTime() - a.started_at.getTime();
}); }
public filter(skill: tID|null) {
this.skill = skill;
if ( skill == null ) {
this.projects = projects.all().sort(this.sort_projects);
return;
}
this.projects = projects.bySkill(skill).sort(this.sort_projects);
} }
protected short_date(date: Date): string { protected short_date(date: Date): string {

View File

@ -11,12 +11,14 @@
"home.line5-3": "(Arduino, Raspberry).", "home.line5-3": "(Arduino, Raspberry).",
"timeline.title": "Timeline of projects featuring", "timeline.title": "Timeline of projects featuring",
"timeline.title-all": "Timeline of all projects",
"timeline.back": "Change skill", "timeline.back": "Change skill",
"skills.featured-before": "Featured in", "skills.featured-before": "Featured in",
"skills.featured-after-1": "project", "skills.featured-after-1": "project",
"skills.featured-after-n": "projects", "skills.featured-after-n": "projects",
"skills.browse": "Browse projects", "skills.browse": "Browse projects",
"skills.browse-all": "Browse all projects",
"tag.all": "All", "tag.all": "All",
"tag.web": "Web", "tag.web": "Web",

View File

@ -11,12 +11,14 @@
"home.line5-3": "(Arduino, Raspberry).", "home.line5-3": "(Arduino, Raspberry).",
"timeline.title": "Chronologie des projets avec", "timeline.title": "Chronologie des projets avec",
"timeline.title-all": "Chronologie des tous les projets",
"timeline.back": "Choisir compétence", "timeline.back": "Choisir compétence",
"skills.featured-before": "Apparaît dans", "skills.featured-before": "Apparaît dans",
"skills.featured-after-1": "projet", "skills.featured-after-1": "projet",
"skills.featured-after-n": "projets", "skills.featured-after-n": "projets",
"skills.browse": "Parcourir les projets", "skills.browse": "Parcourir les projets",
"skills.browse-all": "Parcourir tous les projets",
"tag.all": "Tout", "tag.all": "Tout",
"tag.web": "Web", "tag.web": "Web",

View File

@ -1,6 +1,10 @@
import { Projects, Project } from '@/model/projects'; import { Projects, Project } from '@/model/projects';
import { tID } from '@/model/skills'; import { tID } from '@/model/skills';
export function all(): Project[] {
return Projects;
}
// returns all projects featuring a specified skill. Keeping the order of the // returns all projects featuring a specified skill. Keeping the order of the
// projects model // projects model
export function bySkill(skill: tID): Project[] { export function bySkill(skill: tID): Project[] {