Merge branch 'master' of github.com:Klemek/meeting-roulette
This commit is contained in:
+12
-11
@@ -21,24 +21,21 @@
|
|||||||
<br />
|
<br />
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
Meeting duration so far: <b :id="rid + 1">{{ timeText(elapsedTime) }}</b>
|
Meeting duration so far: <b :id="rid + 1">{{ timeText(elapsedTime) }}</b>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Remaining meeting time: <b :id="rid + 2">{{ timeText(totalRemainingTime) }}</b>
|
Remaining meeting time: <b :id="rid + 2">{{ timeText(totalRemainingTime) }}</b>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
End estimated at: <b :id="rid + 3">{{ timeText(estimatedEnd) }}</b>
|
End estimated at: <b :id="rid + 3">{{ timeText(estimatedEnd) }}</b>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Total meeting time: <b :id="rid + 4">{{ timeText(totalTime) }}</b>
|
Total meeting time: <b :id="rid + 4">{{ timeText(totalTime) }}</b>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Overtime: <b :id="rid + 5">{{ timeText(overtimeTime) }}</b>
|
<label for="weighted">Weighted topics:</label> <input
|
||||||
</li>
|
id="weighted"
|
||||||
<li>
|
v-model="weighted"
|
||||||
<label for="wheighted">Wheighted topics</label> <input
|
|
||||||
id="wheighted"
|
|
||||||
v-model="wheighted"
|
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
@@ -86,7 +83,11 @@
|
|||||||
<text
|
<text
|
||||||
:x="d.textPosition"
|
:x="d.textPosition"
|
||||||
y="0"
|
y="0"
|
||||||
style="font: bold 1px sans-serif; text-align: center"
|
style="
|
||||||
|
font: bold 1px sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
font-family: 'Courier New', Courier, monospace;
|
||||||
|
"
|
||||||
dominant-baseline="middle"
|
dominant-baseline="middle"
|
||||||
text-anchor="end"
|
text-anchor="end"
|
||||||
fill="white"
|
fill="white"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ let app = {
|
|||||||
"Topic 1: 60min\nTopic 2: 20min\nTopic 3: 50min\nTopic 4: 20min\nTopic 5:10min\nTopic 6: 10min\nTopic 7: 10min",
|
"Topic 1: 60min\nTopic 2: 20min\nTopic 3: 50min\nTopic 4: 20min\nTopic 5:10min\nTopic 6: 10min\nTopic 7: 10min",
|
||||||
data: [],
|
data: [],
|
||||||
wheelPosition: 0,
|
wheelPosition: 0,
|
||||||
wheighted: false,
|
weighted: false,
|
||||||
timeoutId: 0,
|
timeoutId: 0,
|
||||||
showSelected: false,
|
showSelected: false,
|
||||||
selected: 0,
|
selected: 0,
|
||||||
@@ -58,12 +58,12 @@ let app = {
|
|||||||
svgData() {
|
svgData() {
|
||||||
let totalAngle = 0;
|
let totalAngle = 0;
|
||||||
return this.filteredData.map((item, index) => {
|
return this.filteredData.map((item, index) => {
|
||||||
const ratio = this.wheighted
|
const ratio = this.weighted
|
||||||
? item.time / this.totalRemainingTime
|
? item.time / this.totalRemainingTime
|
||||||
: 1 / this.filteredData.length;
|
: 1 / this.filteredData.length;
|
||||||
const textScale = item.text.length * 1.1;
|
|
||||||
const angleRad = 2 * Math.PI * ratio;
|
const angleRad = 2 * Math.PI * ratio;
|
||||||
const angleDeg = 360 * ratio;
|
const angleDeg = 360 * ratio;
|
||||||
|
const textScale = this.textScale(item.text, angleRad);
|
||||||
totalAngle += angleDeg;
|
totalAngle += angleDeg;
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@@ -84,18 +84,24 @@ let app = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
textScale(text, angleRad) {
|
||||||
|
const r = 1.2;
|
||||||
|
const n = text.length;
|
||||||
|
const k = n + r / (2 * Math.tan(angleRad / 2));
|
||||||
|
return k / r;
|
||||||
|
},
|
||||||
overtime() {
|
overtime() {
|
||||||
return this.timerStarted && this.timerEnd - new Date() <= 0;
|
return this.timerStarted && this.timerEnd - new Date() <= 0;
|
||||||
},
|
},
|
||||||
timerText() {
|
timerText() {
|
||||||
const delta = this.timerStarted
|
const delta = this.timerStarted
|
||||||
? Math.floor((this.timerEnd - new Date()) / 1000)
|
? Math.floor((this.timerEnd - new Date()) / 1000)
|
||||||
: this.showSelected
|
: (this.showSelected
|
||||||
? this.selectedData.time * 60
|
? this.selectedData.time * 60
|
||||||
: 0;
|
: 0);
|
||||||
return `${delta < 0 ? '-' : ''}${String(Math.floor(Math.abs(delta) / 60)).padStart(2, "0")}:${String(
|
return `${delta < 0 ? "-" : ""}${String(
|
||||||
Math.abs(delta) % 60
|
Math.floor(Math.abs(delta) / 60)
|
||||||
).padStart(2, "0")}`;
|
).padStart(2, "0")}:${String(Math.abs(delta) % 60).padStart(2, "0")}`;
|
||||||
},
|
},
|
||||||
beep(remaining = 3) {
|
beep(remaining = 3) {
|
||||||
if (remaining < 0) {
|
if (remaining < 0) {
|
||||||
@@ -119,7 +125,7 @@ let app = {
|
|||||||
}, 150);
|
}, 150);
|
||||||
},
|
},
|
||||||
timeText(minutes) {
|
timeText(minutes) {
|
||||||
if (minutes > 60) {
|
if (minutes >= 60) {
|
||||||
return `${Math.floor(minutes / 60).toFixed(0)}h${(minutes % 60).toFixed(0).padStart(
|
return `${Math.floor(minutes / 60).toFixed(0)}h${(minutes % 60).toFixed(0).padStart(
|
||||||
2,
|
2,
|
||||||
"0"
|
"0"
|
||||||
@@ -154,7 +160,7 @@ let app = {
|
|||||||
},
|
},
|
||||||
getData() {
|
getData() {
|
||||||
const re = /:\s?(?:(?:(\d+)\s?h)?(\d+)?(?:\s?m(?:in)?)?)\s?$/i;
|
const re = /:\s?(?:(?:(\d+)\s?h)?(\d+)?(?:\s?m(?:in)?)?)\s?$/i;
|
||||||
this.setCookie('rawData', btoa(this.rawData));
|
this.setCookie("rawData", btoa(this.rawData));
|
||||||
return this.rawData
|
return this.rawData
|
||||||
.split("\n")
|
.split("\n")
|
||||||
.map((line) => line.trim())
|
.map((line) => line.trim())
|
||||||
@@ -205,11 +211,9 @@ let app = {
|
|||||||
this.timerEnd = new Date(
|
this.timerEnd = new Date(
|
||||||
new Date().getTime() + this.selectedData.time * 60 * 1000
|
new Date().getTime() + this.selectedData.time * 60 * 1000
|
||||||
);
|
);
|
||||||
this.beepTimer = setTimeout(
|
this.beepTimer = setTimeout(() => {
|
||||||
() => {
|
|
||||||
this.beep();
|
this.beep();
|
||||||
}, this.selectedData.time * 60 * 1000
|
}, this.selectedData.time * 60 * 1000);
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
document.title = "Meeting Roulette";
|
document.title = "Meeting Roulette";
|
||||||
}
|
}
|
||||||
@@ -227,7 +231,7 @@ let app = {
|
|||||||
let ca = decodedCookie.split(';');
|
let ca = decodedCookie.split(';');
|
||||||
for (let i = 0; i < ca.length; i++) {
|
for (let i = 0; i < ca.length; i++) {
|
||||||
let c = ca[i];
|
let c = ca[i];
|
||||||
while (c.charAt(0) == ' ') {
|
while (c.charAt(0) == " ") {
|
||||||
c = c.substring(1);
|
c = c.substring(1);
|
||||||
}
|
}
|
||||||
if (c.indexOf(name) == 0) {
|
if (c.indexOf(name) == 0) {
|
||||||
@@ -235,11 +239,11 @@ let app = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
console.log("app mounted");
|
console.log("app mounted");
|
||||||
this.rawData = atob(this.getCookie('rawData', btoa(this.rawData)));
|
this.rawData = atob(this.getCookie("rawData", btoa(this.rawData)));
|
||||||
this.data = this.getData();
|
this.data = this.getData();
|
||||||
setTimeout(this.showApp);
|
setTimeout(this.showApp);
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user