home display stored polls

This commit is contained in:
Tykayn 2021-05-03 10:06:10 +02:00 committed by tykayn
parent d222d88872
commit 1bfe747e4c
7 changed files with 97 additions and 28 deletions

View File

@ -2,10 +2,63 @@
<div class="hero-body"> <div class="hero-body">
<div class="container"> <div class="container">
<div class="column"> <div class="column">
<section class="creation">
<h1 class="title is-1 is-centered">
{{ 'home.create_button' | translate }}
</h1>
<p class="subtitle">
{{
'SENTENCES.framadate-is-an-online-service-for-planning-an-appointment-or-making-a-decision-quickly-and-easily'
| translate
}}
</p>
<div class="container is-max-desktop">
<a role="button" class="button is-fullwidth is-primary is-size-3" routerLink="administration">
{{ 'config.letsgo' | translate }}
</a>
</div>
</section>
<section class="search">
<h1 class="title is-1 is-centered">
{{ 'home.search_title' | translate }}
</h1>
<ul class="poll-list">
<li *ngFor="let p of storageService.userPolls">
<a
class="button is-fullwidth padded"
[routerLink]="'poll/' + p.custom_url + '/consultation'"
>
{{ p.title }}
<i class="fa fa-arrow-right pull-right"></i>
</a>
</li>
</ul>
<form (ngSubmit)="searchMyPolls()">
<div class="search-others">
<label for="search_others">
Je cherche d'autres sondages, qui correspondent à mon mail :
</label>
<input type="email" id="search_others" [ngModel]="storageService.vote_stack.owner.email" />
<button
type="submit"
role="button"
class="button is-outlined is-fullwidth is-info is-size-3"
[disabled]="!storageService.vote_stack.owner.email.length"
routerLink="user/polls"
>
<i class="fa fa-search"></i>
{{ 'home.search_button' | translate }}
</button>
</div>
</form>
</section>
<blockquote class="notification is-info is-light content is-size-3 has-text-weight-light"> <blockquote class="notification is-info is-light content is-size-3 has-text-weight-light">
<h1 class="title"> <h1 class="title">
{{ 'home.title' | translate }} {{ 'home.title' | translate }}
{{ env.appTitle }} {{ environment.appTitle }}
</h1> </h1>
<i class="fa fa-poll"></i> <i class="fa fa-poll"></i>
{{ {{
@ -22,25 +75,11 @@
{{ 'home.subtitle' | translate }} {{ 'home.subtitle' | translate }}
</h2> </h2>
</div> </div>
<div class="column"> <div class="column"></div>
<h2 class="subtitle">
{{ 'home.search_title' | translate }}
</h2>
</div>
</div> </div>
<div class="columns"> <div class="columns">
<div class="column"></div>
<div class="column"> <div class="column">
<a role="button" class="button is-fullwidth is-primary is-size-3" routerLink="administration">
<i class="fa fa-plus-circle"></i>
{{ 'home.create_button' | translate }}
</a>
<img src="assets/img/kind/date.jpeg" alt="sondage date" />
</div>
<div class="column">
<a role="button" class="button is-fullwidth is-info is-size-3" routerLink="user/polls">
<i class="fa fa-search"></i>
{{ 'home.search_button' | translate }}
</a>
<img src="assets/img/kind/classic.jpeg" alt="sondage date" /> <img src="assets/img/kind/classic.jpeg" alt="sondage date" />
</div> </div>
</div> </div>

View File

@ -3,4 +3,25 @@
a .fa { a .fa {
margin-right: 1ch; margin-right: 1ch;
} }
.subtitle {
min-height: 4em;
}
.creation,
.search {
min-height: 20em;
max-width: 40em;
margin-bottom: 10em;
margin-left: auto;
margin-right: auto;
.title {
margin-bottom: 2em;
}
.button {
border: 0;
}
}
.poll-list {
margin: 2em 0;
}
} }

View File

@ -1,5 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { environment } from '../../../../environments/environment'; import { environment } from '../../../../environments/environment';
import { StorageService } from '../../services/storage.service';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
@ -7,5 +8,8 @@ import { environment } from '../../../../environments/environment';
styleUrls: ['./home.component.scss'], styleUrls: ['./home.component.scss'],
}) })
export class HomeComponent { export class HomeComponent {
public env = environment; public environment = environment;
constructor(public storageService: StorageService) {}
searchMyPolls() {}
} }

View File

@ -13,6 +13,8 @@ import {
otherDefaultDates, otherDefaultDates,
TimeSlices, TimeSlices,
} from '../../../../mocks/old-stuff/config/defaultConfigs'; } from '../../../../mocks/old-stuff/config/defaultConfigs';
import { Poll } from '../models/poll.model';
import { Owner } from '../models/owner.model';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@ -25,7 +27,7 @@ export class StorageService {
public language: Language; public language: Language;
@LocalStorage() @LocalStorage()
public userPollsIds: string[]; public userPolls: Poll[] = [];
@LocalStorage() @LocalStorage()
public dateList: DateChoice[] = otherDefaultDates; public dateList: DateChoice[] = otherDefaultDates;
@ -36,6 +38,16 @@ export class StorageService {
@LocalStorage() @LocalStorage()
public vote_stack: Stack = new Stack(); public vote_stack: Stack = new Stack();
constructor() {
if (environment.autofill) {
this.userPolls.push(new Poll(new Owner(), 'Démo: Anniversaire de tonton Patrick', 'aujourdhui-ou-demain'));
this.userPolls.push(new Poll(new Owner(), 'Démo: Atelier cuisine du quartier', 'aujourdhui-ou-demain'));
this.userPolls.push(
new Poll(new Owner(), 'Démo: Réunion du département des chatons', 'aujourdhui-ou-demain')
);
}
}
setChoicesForVoteStack(choices_list: Choice[]) { setChoicesForVoteStack(choices_list: Choice[]) {
this.vote_stack.votes = []; this.vote_stack.votes = [];

View File

@ -1,7 +1,7 @@
:host { :host {
position: fixed; position: fixed;
bottom: 4em; bottom: 4em;
right: 1em; left: 1em;
color: white; color: white;
.feedback-choices { .feedback-choices {
&.active { &.active {

View File

@ -21,7 +21,7 @@ export const environment = {
frontDomain: 'http://tktest.lan', frontDomain: 'http://tktest.lan',
production: false, production: false,
display_routes: true, display_routes: true,
autofill: false, autofill: true,
showDemoWarning: true, showDemoWarning: true,
autoSendNewPoll: false, autoSendNewPoll: false,
appTitle: 'FramaDate Funky', appTitle: 'FramaDate Funky',

View File

@ -24,10 +24,3 @@ button,
.btn--danger { .btn--danger {
@extend .is-danger; @extend .is-danger;
} }
main {
[ng-reflect-router-link] {
min-width: 50%;
margin: 0.5em;
}
}