Skip to content

Commit

Permalink
v0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Lins e Silva committed May 8, 2019
1 parent 5d3e9cd commit 79f57a1
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 165 deletions.
36 changes: 5 additions & 31 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ let win, devtools, serve;
devtools = args.some(val => val === '--devtools');
serve = args.some(val => val === '--serve');

require('electron-context-menu')({
showInspectElement: false
});
const contextMenu = require('electron-context-menu');
contextMenu();

express.use(cors());

Expand Down Expand Up @@ -85,7 +84,8 @@ async function createWindow() {
title: 'simplEOS',
webPreferences: {
nodeIntegration: true,
webSecurity: !serve
webSecurity: !serve,
devTools: false
},
darkTheme: true,
width: 1440,
Expand All @@ -96,6 +96,7 @@ async function createWindow() {
frame: true,
icon: path.join(__dirname, 'src/assets/icons/ico/simpleos.ico')
});
win.removeMenu();
if (serve) {
require('electron-reload')(__dirname, {
electron: path.join(__dirname, 'node_modules', '.bin', 'electron'),
Expand All @@ -117,33 +118,6 @@ async function createWindow() {
win.on('closed', () => {
win = null;
});

const template = [{
label: 'Application',
submenu: [
{type: 'separator'},
{
label: 'Quit',
accelerator: 'Command+Q',
click: function () {
app.quit();
}
}
]
}, {
label: 'Edit',
submenu: [
{label: 'Undo', accelerator: 'CmdOrCtrl+Z', selector: 'undo:'},
{label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', selector: 'redo:'},
{type: 'separator'},
{label: 'Cut', accelerator: 'CmdOrCtrl+X', selector: 'cut:'},
{label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:'},
{label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:'},
{label: 'Select All', accelerator: 'CmdOrCtrl+A', selector: 'selectAll:'}
]
}];
Menu['setApplicationMenu'](Menu['buildFromTemplate'](template));
// win.removeMenu();
}

const gotTheLock = app.requestSingleInstanceLock();
Expand Down
2 changes: 1 addition & 1 deletion ng-dist/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/dashboard/dapp/dapp.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="container-fluid" style="height: 100%;">
<div class="container" style="height: 100%;overflow-x: hidden;">
<div class="clr-row text-center clr-justify-content-center" style="padding-bottom: 10px;">
<div class="clr-col-lg-6">
<h1 class="gray">Contracts</h1>
Expand Down
236 changes: 120 additions & 116 deletions src/app/dashboard/referendum/referendum.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

<div class="container" style="height: 100%;overflow-x: hidden;">
<div #topRef class="card header-card animate">
<div class="card header-card animate">
<div class="clr-row flex-items-xs-around">
<div class="clr-col-lg-4 clr-col-md-5 text-left">
<h4 class="title">Referendum &nbsp;
Expand Down Expand Up @@ -47,140 +48,143 @@ <h5 class="subtitle mt-0">vote for proposals on the EOS Mainnet</h5>
</div>

<div class="clr-row animate">
<ng-container *ngFor='let p of (proposals
| fusejs: searchString :{
"threshold": 0.1,
"distance": 300,
"tokenize": false,
"minMatchCharLength": 1,
"shouldSort": true,
"keys": [
{
"name": "proposal.proposal_name",
"weight": 0.8
},
{
"name": "proposal.title",
"weight": 0.7
},
{
"name":"proposal.json_data.content",
"weight": 0.4
}
]
}
| orderBy: sortExpression : sortReverse : true : comparatorMethod
) | paginate: {itemsPerPage: 16,currentPage: page}'>
<ng-container *ngFor='let p of (proposals
| fusejs: searchString :{
"distance": 300,
"threshold": 0.1,
"tokenize": false,
"minMatchCharLength": 1,
"shouldSort": true,
"keys": [
{
"name": "proposal.proposal_name",
"weight": 0.8
},
{
"name": "proposal.title",
"weight": 0.7
},
{
"name":"proposal.json_data.content",
"weight": 0.4
}
]
}
| orderBy: sortExpression : sortReverse : true : comparatorMethod
) | paginate: {itemsPerPage: 16,currentPage: page}'>

<div class="clr-col-lg-6" *ngIf="p['stats']['staked']['total'] > 0 || isExpired(p['proposal']['expires_at'])">
<div class="card proposal-card" (click)="openSeeMore(p)">
<div class="proposal-body">
<span class="blue" style="font-weight: 500;"
[innerHTML]="'#' + p['fuseJsHighlighted']['proposal']['proposal_name']"></span>
<div class="clr-col-lg-6" *ngIf="p['stats']['staked']['total'] > 0 || isExpired(p['proposal']['expires_at'])">
<div class="card proposal-card" (click)="openLargeView(p)">
<div class="proposal-body">
<span class="blue" style="font-weight: 500;"
[innerHTML]="'#' + p['fuseJsHighlighted']['proposal']['proposal_name']"></span>

<span class="boxExpires {{ isExpired(p.proposal.expires_at) ? 'expired' : 'expires'}}">
{{ getExpiretime(p.proposal.expires_at) }}!
</span>
<div style="clear: both;">
<h4 class="white mt-0" pTooltip="Proposer: {{p.proposal.proposer}}">
<div style="height: 70px" [innerHTML]="p['fuseJsHighlighted'].proposal.title"></div>
</h4>
<span class="boxExpires {{ isExpired(p.proposal.expires_at) ? 'expired' : 'expires'}}">
{{ getExpiretime(p.proposal.expires_at) }}!
</span>
<div style="clear: both;">
<h4 class="white mt-0" pTooltip="Proposer: {{p.proposal.proposer}}">
<div style="height: 70px" [innerHTML]="p['fuseJsHighlighted'].proposal.title"></div>
</h4>

<ng-container *ngIf="p.proposal.json_data">
<div class="gray text-justify proposal-content"
[innerHTML]="sanitizer.bypassSecurityTrustHtml (contentStyle(p['fuseJsHighlighted'].proposal.json_data.content,'text-muted'))"></div>
</ng-container>
</div>
<ng-container *ngIf="p.proposal.json_data">
<div class="gray text-justify proposal-content"
[innerHTML]="sanitizer.bypassSecurityTrustHtml (contentStyle(p['fuseJsHighlighted'].proposal.json_data.content,'text-muted'))"></div>
</ng-container>
</div>

<button
*ngIf="(!isExpired(p.proposal.expires_at)) && ((p.proposal.json_data.type !== 'options-v1') && (p.proposal.json_data.type !== 'multi-select-v1'))"
type="button" class="btn btn-outline btn-info-outline"
(click)="startVote(p,0, $event);"
style="margin-top: 15px; padding:0px 17px !important;">
0 - No
</button>
<button
*ngIf="(!isExpired(p.proposal.expires_at)) && ((p.proposal.json_data.type !== 'options-v1') && (p.proposal.json_data.type !== 'multi-select-v1'))"
type="button" class="btn btn-outline btn-info-outline"
(click)="startVote(p,1, $event);"
style="margin-top: 15px; padding:0px 17px !important;">
1 - Yes
</button>
<button
*ngIf="(!isExpired(p.proposal.expires_at)) && (p.proposal.json_data.type==='poll-yna-v1')"
type="button" class="btn btn-outline btn-info-outline"
(click)="startVote(p,2, $event);"
style="margin-top: 15px; padding:0px 17px !important;">
2 - Abstain
</button>

<button
*ngIf="(!isExpired(p.proposal.expires_at)) && ((p.proposal.json_data.type !== 'options-v1') && (p.proposal.json_data.type !== 'multi-select-v1'))"
type="button" class="btn btn-outline btn-info-outline"
(click)="startVote(p,0, $event);"
style="margin-top: 15px; padding:0px 17px !important;">
0 - No
</button>
<button
*ngIf="(!isExpired(p.proposal.expires_at)) && ((p.proposal.json_data.type !== 'options-v1') && (p.proposal.json_data.type !== 'multi-select-v1'))"
type="button" class="btn btn-outline btn-info-outline"
(click)="startVote(p,1, $event);"
style="margin-top: 15px; padding:0px 17px !important;">
1 - Yes
</button>
<button
*ngIf="(!isExpired(p.proposal.expires_at)) && (p.proposal.json_data.type==='poll-yna-v1')"
type="button" class="btn btn-outline btn-info-outline"
(click)="startVote(p,2, $event);"
style="margin-top: 15px; padding:0px 17px !important;">
2 - Abstain
</button>
<div
*ngIf="(!isExpired(p.proposal.expires_at)) && ((p.proposal.json_data.type==='options-v1') || (p.proposal.json_data.type==='multi-select-v1'))"
style="float:left;">
<mat-form-field class="example-full-width"
style=" margin-right:10px;width: 207px;">
<mat-select placeholder="Select an option"
(selectionChange)="multiSelect(p,$event.value, $event)"
[multiple]="p.proposal.json_data.type==='multi-select-v1'">
<mat-option *ngFor="let option of p.proposal.json_data['options']"
[value]="p.proposal.json_data['options'].indexOf(option)">
{{p.proposal.json_data['options'].indexOf(option)}} - {{ option }}
</mat-option>
</mat-select>
</mat-form-field>

<div
*ngIf="(!isExpired(p.proposal.expires_at)) && ((p.proposal.json_data.type==='options-v1') || (p.proposal.json_data.type==='multi-select-v1'))"
style="float:left;">
<mat-form-field class="example-full-width"
style=" margin-right:10px;width: 207px;">
<mat-select placeholder="Select an option"
(selectionChange)="multiSelect(p,$event.value, $event)"
[multiple]="p.proposal.json_data.type==='multi-select-v1'">
<mat-option *ngFor="let option of p.proposal.json_data['options']"
[value]="p.proposal.json_data['options'].indexOf(option)">
{{p.proposal.json_data['options'].indexOf(option)}} - {{ option }}
</mat-option>
</mat-select>
</mat-form-field>
<button type="button" class="btn btn-outline btn-info-outline"
(click)="startMultiVote(p, $event)"
style="margin-top: 9px; padding:0px 17px !important;">
Vote
</button>
</div>

<button type="button" class="btn btn-outline btn-info-outline"
(click)="startMultiVote(p, $event)"
style="margin-top: 9px; padding:0px 17px !important;">
Vote
<button *ngIf="!isExpired(p.proposal.expires_at)" type="button"
class="btn btn-outline btn-info-outline"
(click)="startUnvote(p, $event)"
style="margin-top: 15px; padding:0px 17px !important;">
Unvote
</button>
</div>
<div class="card-footer proposal-footer">

<button *ngIf="!isExpired(p.proposal.expires_at)" type="button"
class="btn btn-outline btn-info-outline"
(click)="startUnvote(p, $event)"
style="margin-top: 15px; padding:0px 17px !important;">
Unvote
</button>
</div>
<div class="card-footer proposal-footer">

<mat-progress-bar
*ngIf="((p.proposal.json_data.type !== 'options-v1') && (p.proposal.json_data.type !== 'multi-select-v1'))"
class="proposal-progress"
color="warn"
mode="determinate"
[value]="(p.stats.staked['1'] / p.stats.staked['total']) * 100">
</mat-progress-bar>
<mat-progress-bar
*ngIf="((p.proposal.json_data.type !== 'options-v1') && (p.proposal.json_data.type !== 'multi-select-v1'))"
class="proposal-progress"
color="warn"
mode="determinate"
[value]="(p.stats.staked['1'] / p.stats.staked['total']) * 100">
</mat-progress-bar>

<div style="padding: 10px 19px; font-weight: 600;">
<div style="padding: 10px 19px; font-weight: 600;">

<ng-container
*ngIf="((p.proposal.json_data.type !== 'options-v1') && (p.proposal.json_data.type !== 'multi-select-v1'))">
<span class="green" tooltipStyleClass="vote-info" pTooltip="Voters: {{p.stats.votes['1']}}&#13;Total: {{(p.stats.staked['1'] / 10000) | number : '1.2-4'}} EOS">
{{((p.stats.staked['1'] / p.stats.staked['total']) * 100) | number : '1.1-1'}}%
</span>
<span class="red" tooltipStyleClass="vote-info" pTooltip="Voters: {{p.stats.votes['0']}}&#13;Total: {{(p.stats.staked['0'] / 10000) | number : '1.2-4'}} EOS" style="float: right">
{{((p.stats.staked['0'] / p.stats.staked['total']) * 100) | number : '1.1-1'}}%
</span>
</ng-container>
<ng-container
*ngIf="((p.proposal.json_data.type !== 'options-v1') && (p.proposal.json_data.type !== 'multi-select-v1'))">
<span class="green" tooltipStyleClass="vote-info"
pTooltip="Voters: {{p.stats.votes['1']}}&#13;Total: {{(p.stats.staked['1'] / 10000) | number : '1.2-4'}} EOS">
{{((p.stats.staked['1'] / p.stats.staked['total']) * 100) | number : '1.1-1'}}%
</span>
<span class="red" tooltipStyleClass="vote-info"
pTooltip="Voters: {{p.stats.votes['0']}}&#13;Total: {{(p.stats.staked['0'] / 10000) | number : '1.2-4'}} EOS"
style="float: right">
{{((p.stats.staked['0'] / p.stats.staked['total']) * 100) | number : '1.1-1'}}%
</span>
</ng-container>

<div class="text-white" [textMask]="{mask: numberMask}">
{{(p.stats.staked['total'] / 10000) | number : '1.2-4' }} EOS voted
<span style="color: #989898;">
({{p.stats.votes['total']}} voters)
</span>
<div class="text-white" [textMask]="{mask: numberMask}">
{{(p.stats.staked['total'] / 10000) | number : '1.2-4' }} EOS voted
<span style="color: #989898;">
({{p.stats.votes['total']}} voters)
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</ng-container>
</ng-container>
</div>
<br>
<div class="clr-row ">
<div class="clr-col-12 pagination-row text-center">
<pagination-controls (pageChange)="page = $event;onPage(topRef)" ></pagination-controls>
<pagination-controls (pageChange)="page = $event" ></pagination-controls>
</div>
</div>
<br>
Expand All @@ -197,7 +201,7 @@ <h3 class="modal-title text-white">
</b>
</span>
proposed by
<span class="blue" >
<span class="blue">
{{sMProposer}}
</span>
</h3>
Expand Down
14 changes: 6 additions & 8 deletions src/app/dashboard/referendum/referendum.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, ComponentFactoryResolver, OnInit} from '@angular/core';
import {Component, ComponentFactoryResolver, ChangeDetectorRef, OnInit} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {AccountsService} from '../../services/accounts.service';
import {EOSJSService} from '../../services/eosjs.service';
Expand Down Expand Up @@ -66,7 +66,8 @@ export class ReferendumComponent implements OnInit {
private componentFactoryResolver: ComponentFactoryResolver,
private toaster: ToasterService,
private crypto: CryptoService,
public sanitizer: DomSanitizer
public sanitizer: DomSanitizer,
private cdr: ChangeDetectorRef
) {

this.searchForm = this.fb.group({
Expand All @@ -89,17 +90,13 @@ export class ReferendumComponent implements OnInit {
this.sMType = '';
}

onPage($element) {
$element.scrollIntoView({behavior: "smooth", block: "start", inline: "nearest"});
window.scrollTo(0,-107);
}

ngOnInit(): void {
setTimeout(() => {
this.loadVoteTally();
}, 200);
}


extOpen(value) {
return window['shell']['openExternal'](value);
}
Expand Down Expand Up @@ -178,6 +175,7 @@ export class ReferendumComponent implements OnInit {
this.allProposals = this.proposals;
this.loading = false;
}
this.cdr.detectChanges();
}

processProposalData(data) {
Expand Down Expand Up @@ -391,7 +389,7 @@ export class ReferendumComponent implements OnInit {
return newTxt;
}

openSeeMore(p) {
openLargeView(p) {
this.selProposal = p;
this.seeMore = true;
// console.log(p);
Expand Down
Loading

0 comments on commit 79f57a1

Please sign in to comment.