Skip to content

Commit

Permalink
feat: auto-maximize for projector;
Browse files Browse the repository at this point in the history
feat: make the title bar's text look bigger/origin size after clicking on it;

update: move projector's bottom bar to top;

fix: 20% majority -> 20% of the number;

fix: 已经有一个Console Lite实例在运行 on Windows caused by limited user privilege;

fix: old yarn.lock cause yarn install 's failure (see yarnpkg/yarn#6312);

fix: Minio.Client complaining secure option deprecated;
  • Loading branch information
XieJiSS committed Feb 21, 2019
1 parent 7e7e2b3 commit ba92dc5
Show file tree
Hide file tree
Showing 7 changed files with 1,630 additions and 1,106 deletions.
3 changes: 3 additions & 0 deletions bin/pack.js
Expand Up @@ -21,6 +21,9 @@ function pack(cb, silent) {
/^\/Console-Lite-/,
], // Ignores databases, files and artifacts
icon: path.join(__dirname, '../images/icon'),
win32metadata: {
'requested-execution-level': 'requireAdministrator',
},
};

if(process.env.ELECTRON_MIRROR)
Expand Down
21 changes: 20 additions & 1 deletion main.js
@@ -1,5 +1,5 @@
const electron = require('electron');
const { ipcMain, app, protocol, globalShortcut, BrowserWindow } = electron;
const { ipcMain, app, protocol, globalShortcut, BrowserWindow, screen, } = electron;
const path = require('path');
const tar = require('tar');
const fs = require('fs');
Expand Down Expand Up @@ -65,10 +65,29 @@ function initProjector() {
// Ensures that previous windows are closed
if(projector) projector.close();

const displays = screen.getAllDisplays();
let shouldFillScreen = false;
if(displays.length <= 1) {
projectorOpt.x = 0;
projectorOpt.y = 0;
} else
for(let i = 0; i < displays.length; i++)
if(displays[i].bounds.x !== 0 || displays[i].bounds.y !== 0) {
const externalDisp = displays[i];
projectorOpt.x = externalDisp.bounds.x;
projectorOpt.y = externalDisp.bounds.y;
shouldFillScreen = true;
break;
}

projector = new BrowserWindow(projectorOpt);
projector.loadURL(`file://${__dirname}/projector/index.html`);
util.applyProjectorMenu(projector);

projector.webContents.on('dom-ready', () => {
if(shouldFillScreen && projector.isMaximizable()) projector.maximize();
});

projector.on('closed', () => {
projector = null;
if(controller) controller.webContents.send('projectorClosed');
Expand Down
6 changes: 6 additions & 0 deletions projector/action.js
Expand Up @@ -34,6 +34,7 @@ const desc = {

list: null,
stashedlist: null,
titleSize: 'small',
},

mounted() {
Expand All @@ -54,6 +55,11 @@ const desc = {
ipcRenderer.send('projectorInitialized');
},

toggleTitleSize() {
if(this.$data.titleSize === 'small') this.$data.titleSize = 'big';
else this.$data.titleSize = 'small';
},

_scrollSmooth(el, to) {
const current = el.scrollLeft;
const startTime = performance.now();
Expand Down
31 changes: 18 additions & 13 deletions projector/index.html
Expand Up @@ -15,8 +15,8 @@
</div>

<transition name="opacity">
<div class="bottom-bar" v-show="connected">
<div class="bottom-title small">
<div class="top-bar" v-show="connected">
<div class="top-title small">
<span>{{ conf }}</span>
</div>
<div class="counter-group">
Expand All @@ -35,7 +35,7 @@
<div class="counter-indicator-value">{{ twoThirdCount }}</div>
</div>
<div class="counter-indicator">
<div class="counter-indicator-hint">20%多数</div>
<div class="counter-indicator-hint">20%</div>
<div class="counter-indicator-value">{{ twentyPercentCount }}</div>
</div>
</div>
Expand All @@ -53,8 +53,8 @@
</div>

<div class="layer file-layer full" v-show="mode === 'file'">
<div class="bottom-bar">
<div class="bottom-title">
<div class="top-bar">
<div class="top-title">
<i class="material-icons">insert_drive_file</i><span>{{ shortName }}</span>
</div>
</div>
Expand All @@ -69,8 +69,8 @@
</div>

<div class="layer full vote-layer" v-if="mode === 'vote' && vote">
<div class="bottom-bar">
<div class="bottom-title">
<div class="top-bar">
<div class="top-title">
<i class="material-icons">thumbs_up_down</i><span>{{ vote.name }}</span>
</div>
<div class="vote-iteration" v-if="vote.status.iteration > 0">
Expand Down Expand Up @@ -153,23 +153,28 @@
</div>

<div class="layer list-layer full" v-if="mode === 'list'">
<div class="bottom-bar">
<div class="bottom-title small">
<i class="material-icons">record_voice_over</i><span>{{ list.name }}</span>
<div class="top-bar">
<div class="top-title small clickable" @click="toggleTitleSize()" v-if="titleSize === 'small'">
<i class="material-icons">record_voice_over</i>
<span>{{ list.name }}</span>
</div>
<div class="speaker-indicator" v-if="list.ptr < list.seats.length">
<div class="top-title big clickable" @click="toggleTitleSize()" v-if="titleSize === 'big'">
<i class="material-icons">record_voice_over</i>
<span>{{ list.name }}</span>
</div>
<div class="speaker-indicator" v-if="list.ptr < list.seats.length && titleSize === 'small'">
<span class="speaker-current">
{{ list.seats[list.ptr].name }}
</span>
<span class="speaker-next" v-if="list.ptr < list.seats.length - 1">
{{ list.seats[list.ptr + 1].name }}
</span>
</div>
<div class="timer-current" v-if="list.timerCurrent">
<div class="timer-current" v-if="list.timerCurrent && titleSize === 'small'">
<i class="material-icons">person</i>
<timer :time="list.timerCurrent.left" :fix-minute="true"></timer>
</div>
<div class="timer-total" v-if="list.timerTotal && list.timerTotal.value > 0">
<div class="timer-total" v-if="list.timerTotal && list.timerTotal.value > 0 && titleSize === 'small'">
<i class="material-icons">access_time</i>
<timer :time="list.timerTotal.left" :fix-minute="true"></timer>
</div>
Expand Down
24 changes: 16 additions & 8 deletions projector/style.css
Expand Up @@ -46,21 +46,21 @@ body {
bottom: 0;
}

.bottom-bar {
.top-bar {
position: absolute;
bottom: 0;
top: 0vw;
right: 0;
left: 0;
height: 12.5vw;
box-sizing: border-box;
border-top: rgba(0,0,0,.12) .125vw solid;
border-bottom: rgba(0,0,0,.12) .125vw solid;

display: flex;
align-items: center;
padding: 0 5vw;
}

.bottom-title {
.top-title {
font-size: 4vw;
overflow: hidden;
display: flex;
Expand All @@ -69,16 +69,24 @@ body {
white-space: nowrap;
}

.bottom-title > span {
.top-title > span {
overflow: hidden;
text-overflow: ellipsis;
}

.bottom-title.small {
.top-title.small {
font-size: 3vw;
}

.bottom-title .material-icons {
.top-title.big {
font-size: 5vw;
}

.top-title.clickable {
cursor: pointer;
}

.top-title .material-icons {
margin-right: 2vw;
font-size: 4vw;
}
Expand All @@ -87,7 +95,7 @@ body {
display: flex;
align-items: center;
justify-content: center;
padding-bottom: 12.5vw;
padding-top: 12.5vw;
}

.brand {
Expand Down
2 changes: 1 addition & 1 deletion util.js
Expand Up @@ -243,7 +243,7 @@ function checkForUpdate() {
return new Promise((resolve, reject) => {
if(!_mc) _mc = new Minio.Client({
endPoint: 'store.bjmun.org',
secure: true,
useSSL: true,
});

fs.readFile(path.join(__dirname, 'VERSION'), (err, buf) => {
Expand Down

0 comments on commit ba92dc5

Please sign in to comment.