Skip to content

Commit

Permalink
General application clean-up.
Browse files Browse the repository at this point in the history
  • Loading branch information
marchantweb committed Dec 21, 2021
1 parent 7caa1b4 commit 2c1c4b9
Show file tree
Hide file tree
Showing 16 changed files with 245 additions and 265 deletions.
6 changes: 3 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<v-app id="app">
<Header/>
<canvas id="previewDisplay" width="1920" height="160" style="width: 100vw; height: 9vw; background-color: #e7e7e7;"></canvas>
<v-bottom-navigation v-model="previewMode" color="#292a3c" background-color="#d7eaee" horizontal elevation="1" style="width: 100%; box-shadow: none; margin-bottom: 20px">
<canvas id="previewDisplay" height="160" style="width: 100vw; height: 9vw; background-color: #e7e7e7;" width="1920"></canvas>
<v-bottom-navigation v-model="previewMode" background-color="#d7eaee" color="#292a3c" elevation="1" horizontal style="width: 100%; box-shadow: none; margin-bottom: 20px">
<v-btn>
<span>Light Preview</span>
<v-icon>mdi-lightbulb-group-outline</v-icon>
Expand Down Expand Up @@ -98,7 +98,7 @@ export default {
}
@media only screen and (max-width: 1400px) {
#content{
#content {
padding: 0;
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,35 @@ function copyAssets() {
// auto generate assets list based on starter pack assets
default_shows.forEach(show => {
// get thumbnail
assets.push( show.info.thumbnail);
assets.push(show.info.thumbnail);

// get any file input types
Object.keys(show.controls).forEach(key => {
const control = show.controls[key];
if( control.type === 'image'){
if (control.type === 'image') {
assets.push(control.value);
}
});
});

assets.forEach(function(item) {
assets.forEach(function (item) {
// const srcPath = path.join('src', 'assets', item);
const srcPath = path.join(__dirname, '..', 'extraResources', item)
const destPath = path.join(destDir, item);

fse.pathExists(destPath, (err, exists) => {
// Error in evaluation
if (err) { console.log(err) }
if (err) {
console.log(err)
}
// Evaluation result t/f
if (exists) {
// File Exists
} else {
// Assets Copying
fse.copy(srcPath, destPath, (err) => {
if (err) return console.error(err)
});
}).catch(console.log);
}
})
})
Expand Down
6 changes: 3 additions & 3 deletions src/background.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

import {app, protocol, BrowserWindow, Menu} from 'electron'
import {app, BrowserWindow, Menu, protocol} from 'electron'
import {createProtocol} from 'vue-cli-plugin-electron-builder/lib'
import {copyAssets} from './assets'

Expand Down Expand Up @@ -57,13 +57,13 @@ function createWindow() {
{
label: 'About Illuminations',
click() {
shell.openExternal('https://illuminations.mit.edu/')
shell.openExternal('https://illuminations.mit.edu/').catch(console.log);
}
},
{
label: 'Bug Report / Feature Request',
click() {
shell.openExternal('https://github.com/sosolimited/MIT-Illuminations/issues')
shell.openExternal('https://github.com/sosolimited/MIT-Illuminations/issues').catch(console.log);
}
},
]
Expand Down
18 changes: 9 additions & 9 deletions src/components/Control.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<template>
<v-card class="mx-20" width="300" elevation="2" height="100%" :disabled="readonly">
<v-card :disabled="readonly" class="mx-20" elevation="2" height="100%" width="300">
<v-card-subtitle class="pa-0 mx-2 mt-4 font-weight-bold">
{{ controlObj.name }} {{ controlIsUsedInCode ? '' : ' (unused)' }}
</v-card-subtitle>
<v-card-subtitle
class="pa-0 mx-2 mb-4"
v-if="controlObj.type.toLowerCase() !== 'image'"
class="pa-0 mx-2 mb-4"
>
{{ `controls.${controlObj.id}.value = ${controlObj.value}` }}
</v-card-subtitle>
<v-card-subtitle class="pa-0 mx-2 mb-4" v-else>
<v-card-subtitle v-else class="pa-0 mx-2 mb-4">
{{ `p5.loadControlImage(controls.${controlObj.id}.value)` }}
</v-card-subtitle>

Expand All @@ -27,11 +27,11 @@
</v-col>
<v-col cols="10">
<v-slider
dense
:min="controlObj.min"
:max="controlObj.max"
:min="controlObj.min"
:step="controlObj.step"
:value="controlObj.value"
dense
@end="updateControlValue"
></v-slider>
</v-col>
Expand All @@ -42,32 +42,32 @@

<!-- IMAGE UPLOADER -->
<v-img
class="mt-5 mb-2"
v-if="controlObj.type.toLowerCase() === 'image'"
:src="assetSrc"
class="mt-5 mb-2"
>
</v-img>
<v-file-input
v-if="controlObj.type.toLowerCase() === 'image'"
:clearable="false"
accept=".png"
class="mx-3"
:clearable="false"
dense
prepend-icon="mdi-file-upload"
@change="copyAsset"
></v-file-input>

<!-- Card Description -->
<v-card-subtitle class="pa-0 mx-2" v-if="controlObj.description">
<v-card-subtitle v-if="controlObj.description" class="pa-0 mx-2">
{{ controlObj.description }}
</v-card-subtitle>

<v-card-actions>
<v-btn
:disabled="controlIsUsedInCode"
color="red"
small
text
color="red"
@click="deleteUnusedControl"
>
Delete control
Expand Down
46 changes: 23 additions & 23 deletions src/components/ControlForm.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<v-row justify="center">
<v-dialog v-model="dialog" persistent max-width="600px">
<v-dialog v-model="dialog" max-width="600px" persistent>
<template v-slot:activator="{ on, attrs }">
<v-btn
:disabled="readonly"
class="mr-4 mt-8"
outlined
small
text
outlined
v-bind="attrs"
v-on="on"
>
Expand All @@ -26,64 +26,64 @@
<!-- Control type -->
<v-col cols="6">
<v-select
v-model="controlObj.type"
:items="['Color', 'Number', 'Image']"
label="Control type"
required
outlined
v-model="controlObj.type"
required
></v-select>
</v-col>

<!-- Control name -->
<v-col cols="6">
<v-text-field
v-model="controlObj.name"
:hint="controlObj.name ? 'Use this variable in your code: controls.' + toCamelCase(controlObj.name) + '.value' : ''"
:rules="rules.name"
label="Control name"
required
outlined
:hint="controlObj.name ? 'Use this variable in your code: controls.' + toCamelCase(controlObj.name) + '.value' : ''"
persistent-hint
v-model="controlObj.name"
:rules="rules.name"
required
></v-text-field>
</v-col>

<!-- Number-specific -->
<v-col cols="4" v-if="controlObj.type.toLowerCase() ==='number'">
<v-col v-if="controlObj.type.toLowerCase() ==='number'" cols="4">
<v-text-field
type="number"
label="Minimum"
hint="The minimum allowed value"
v-model="controlObj.min"
hint="The minimum allowed value"
label="Minimum"
required
type="number"
></v-text-field>
</v-col>
<v-col cols="4" v-if="controlObj.type.toLowerCase() ==='number'">
<v-col v-if="controlObj.type.toLowerCase() ==='number'" cols="4">
<v-text-field
type="number"
label="Maximum"
hint="The maximum allowed value"
v-model="controlObj.max"
hint="The maximum allowed value"
label="Maximum"
required
type="number"
></v-text-field>
</v-col>
<v-col cols="4" v-if="controlObj.type.toLowerCase() ==='number'">
<v-col v-if="controlObj.type.toLowerCase() ==='number'" cols="4">
<v-text-field
type="number"
label="Step"
hint="The step between allowed values"
v-model="controlObj.step"
hint="The step between allowed values"
label="Step"
required
type="number"
></v-text-field>
</v-col>

<!-- Control description -->
<v-col cols="12">
<v-text-field
label="Description"
v-model="controlObj.description"
hint="Add some notes to help people understand how this control impacts the code (optional)"
persistent-hint
label="Description"
outlined
persistent-hint
></v-text-field>
</v-col>

Expand All @@ -97,7 +97,7 @@
<v-btn color="blue darken-1" text @click="close">
Close
</v-btn>
<v-btn color="blue darken-1" text @click="saveAndClose" :disabled="!valid">Save</v-btn>
<v-btn :disabled="!valid" color="blue darken-1" text @click="saveAndClose">Save</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
Expand Down
8 changes: 4 additions & 4 deletions src/components/Header.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<v-app-bar color="white" id="header" elevation="1" height="60">
<div v-on:click="returnToHome()" style="display: flex; align-items: center; cursor: pointer;">
<img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" alt="MIT Logo (SVG)" class="header__logo">
<v-app-bar id="header" color="white" elevation="1" height="60">
<div style="display: flex; align-items: center; cursor: pointer;" v-on:click="returnToHome()">
<img alt="MIT Logo (SVG)" class="header__logo" src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg">
<div id="header-title">Illuminations — Turn P5 Code into Light Shows</div>
</div>
<v-spacer></v-spacer>
Expand Down Expand Up @@ -40,7 +40,7 @@ export default {
toggleLightsStatus() {
this.$store.commit('toggleLightsStatus')
},
returnToHome(){
returnToHome() {
this.$router.push({name: 'home'});
}
}
Expand Down

0 comments on commit 2c1c4b9

Please sign in to comment.