🔨 fix linting, add env default

This commit is contained in:
tykayn 2020-04-11 16:16:25 +02:00
parent 9bdd4e0084
commit 6e6b812d2d
3 changed files with 43 additions and 25 deletions

View File

@ -21,6 +21,7 @@ export class AppComponent {
@Inject(DOCUMENT) private document, @Inject(DOCUMENT) private document,
private route: Router) { private route: Router) {
this.detectCurrentTabOnRouteChange(); this.detectCurrentTabOnRouteChange();
this.findLocalStoragePreferences();
this.isDevelopmentEnv = !environment.production this.isDevelopmentEnv = !environment.production
} }
@ -54,4 +55,14 @@ export class AppComponent {
} }
} }
} }
public findLocalStoragePreferences() {
const storage = window.localStorage;
if ( storage ){
const preferences = storage.getItem('FramadateConfig');
}
}
} }

View File

@ -1,8 +1,8 @@
/** /**
* une option de date dans les sondages spéciaux * une option de date dans les sondages spéciaux
*/ */
import {environment} from "../../environments/environment"; import {environment} from '../../environments/environment';
import {DateChoice, defaultAnswers, otherDefaultDates, PollAnswer} from "./defaultConfigs"; import {DateChoice, defaultAnswers, otherDefaultDates, PollAnswer} from './defaultConfigs';
export interface DateOption { export interface DateOption {
timeList: any; timeList: any;
@ -11,11 +11,11 @@ export interface DateOption {
} }
const baseConfigValues = { const baseConfigValues = {
pollType: "classic", pollType: 'dates',
title: "", title: '',
description: "", description: '',
myName: "", myName: '',
myEmail: "", myEmail: '',
}; };
@ -28,20 +28,22 @@ export class PollConfig {
expiracyDateDefaultInDays = 60; expiracyDateDefaultInDays = 60;
deletionDateAfterLastModification = 180; deletionDateAfterLastModification = 180;
step: number = 0; // step in the progress of creating a poll step = 0; // step in the progress of creating a poll
stepMax: number = 3; // step max in the progress of creating a poll stepMax = 3; // step max in the progress of creating a poll
pollType: string = 'dates';// classic or dates pollType = 'dates';// classic or dates
title: string = 'titre'; title: string = environment.production ? '' : 'titre';
description: string = 'ma description'; description: string = environment.production ? '' : 'ma description';
myName: string = 'mon pseudo'; myName: string = environment.production ? '' : 'mon pseudo';
myComment: string = 'wouah trop bien framadate!'; myComment: string = environment.production ? '' : 'wouah trop bien framadate!';
isAdmin: boolean = true; isAdmin: boolean = !environment.production;
myVoteStack: any; myVoteStack: any;
myTempVoteStack = 0; myTempVoteStack = 0;
myEmail: string = "tktest@tktest.com"; myEmail: string = environment.production ? '' : 'tktest@tktest.com';
myPolls: any = [];// list of retrieved polls from the backend api myPolls: any = [];// list of retrieved polls from the backend api
// date specific poll, we have the choice to setup different hours (timeList) for all possible dates (dateList), or use the same hours for all dates /*
date specific poll, we have the choice to setup different hours (timeList) for all possible dates (dateList), or use the same hours for all dates
*/
allowSeveralHours = 'true'; allowSeveralHours = 'true';
// access // access
visibility = 'link_only'; // visible to anyone with the link: visibility = 'link_only'; // visible to anyone with the link:
@ -57,12 +59,12 @@ export class PollConfig {
customUrl = ''; // custom slug in the url, must be unique customUrl = ''; // custom slug in the url, must be unique
customUrlIsUnique = null; // given by the backend customUrlIsUnique = null; // given by the backend
urlSlugPublic = null; urlSlugPublic = null;
urlPublic = environment.baseHref + '/#/poll/id/4'; urlPublic = environment.production ? '' : environment.baseHref + '/#/poll/id/4';
urlAdmin = environment.baseHref + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345'; urlAdmin = environment.baseHref + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
adminKey = ''; // key to change config of the poll adminKey = ''; // key to change config of the poll
owner_modifier_token = ''; // key to change a vote stack owner_modifier_token = ''; // key to change a vote stack
canModifyAnswers: boolean = true;// bool for the frontend selector canModifyAnswers = true;// bool for the frontend selector
whoModifiesAnswers = "everybody";// everybody, self, nobody (= just admin) whoModifiesAnswers = 'everybody';// everybody, self, nobody (= just admin)
whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin) whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin)
dateList: any = otherDefaultDates; // sets of days as strings, config to set identical time for days in a special days poll dateList: any = otherDefaultDates; // sets of days as strings, config to set identical time for days in a special days poll
timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings
@ -70,15 +72,15 @@ export class PollConfig {
answers: PollAnswer[] = defaultAnswers; answers: PollAnswer[] = defaultAnswers;
// front end choices // front end choices
themeChoices: string[] = ['light-watermelon', 'dark-crystal', 'hot-covid']; themeChoices: string[] = ['light-watermelon', 'dark-crystal', 'hot-covid'];
themeSelected: number = 0; themeSelected = 0;
themeClass: string = 'theme-light-watermelon'; themeClass = 'theme-light-watermelon';
// modals // modals
displayConfirmVoteModalAdmin: boolean = false; displayConfirmVoteModalAdmin = false;
resetConfig() { resetConfig() {
const self = this; const self = this;
Object.keys(baseConfigValues).forEach((key) => { Object.keys(baseConfigValues).forEach((key) => {
self[key] = baseConfigValues[key]; self[key] = baseConfigValues[key];
}) });
} }
} }

View File

@ -133,9 +133,14 @@ $breakpoint-responsive: 640px; // à définir
left: auto; left: auto;
} }
} }
&:focus, &:active {
border-color: #bf83c2;
color: #bf83c2;
background: #000;
}
&--active { &--active {
border-color: #bf83c2; border-color: #bf83c2;
} }
@media (min-width: $breakpoint-responsive) { @media (min-width: $breakpoint-responsive) {