Skip to content

Commit fb01b69

Browse files
authored
Merge pull request #3 from drewngyen/image-upload
Image upload
2 parents afb4f48 + 99d1e85 commit fb01b69

File tree

78 files changed

+2307
-12746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2307
-12746
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ node_modules
1111
npm-debug.log*
1212
yarn-debug.log*
1313
yarn-error.log*
14-
/test/jest/coverage
14+
/test
15+
/coverage
1516

1617
# Editor directories and files
1718
.idea

package-lock.json

Lines changed: 1946 additions & 157 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
"private": true,
99
"scripts": {
1010
"lint": "eslint --ext .js,.vue src",
11-
"test": "echo \"No test specified\" && exit 0"
11+
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
12+
"test:unit": "jest --updateSnapshot",
13+
"test:unit:coverage": "jest --coverage",
14+
"test:unit:watch": "jest --watch",
15+
"test:unit:watchAll": "jest --watchAll",
16+
"serve:test:coverage": "quasar serve test/jest/coverage/lcov-report/ --port 8788",
17+
"concurrently:dev:jest": "concurrently \"quasar dev\" \"jest --watch\""
1218
},
1319
"dependencies": {
1420
"@quasar/extras": "^1.0.0",

quasar.extensions.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
22
"@quasar/testing": {
3-
"harnesses": [
4-
"unit-jest"
5-
]
3+
"harnesses": ["unit-jest"]
64
},
75
"@quasar/testing-unit-jest": {
86
"babel": "babelrc",
97
"options": []
108
}
11-
}
9+
}
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import { app, BrowserWindow } from 'electron'
1+
import { app, BrowserWindow } from "electron";
22

33
/**
44
* Set `__statics` path to static files in production;
55
* The reason we are setting it here is that the path needs to be evaluated at runtime
66
*/
77
if (process.env.PROD) {
8-
global.__statics = require('path').join(__dirname, 'statics').replace(/\\/g, '\\\\')
8+
global.__statics = require("path")
9+
.join(__dirname, "statics")
10+
.replace(/\\/g, "\\\\");
911
}
1012

11-
let mainWindow
13+
let mainWindow;
1214

13-
function createWindow () {
15+
function createWindow() {
1416
/**
1517
* Initial window options
1618
*/
@@ -19,27 +21,28 @@ function createWindow () {
1921
height: 600,
2022
useContentSize: true,
2123
webPreferences: {
22-
nodeIntegration: true
24+
nodeIntegration: true,
25+
webSecurity: false
2326
}
24-
})
27+
});
2528

26-
mainWindow.loadURL(process.env.APP_URL)
29+
mainWindow.loadURL(process.env.APP_URL);
2730

28-
mainWindow.on('closed', () => {
29-
mainWindow = null
30-
})
31+
mainWindow.on("closed", () => {
32+
mainWindow = null;
33+
});
3134
}
3235

33-
app.on('ready', createWindow)
36+
app.on("ready", createWindow);
3437

35-
app.on('window-all-closed', () => {
36-
if (process.platform !== 'darwin') {
37-
app.quit()
38+
app.on("window-all-closed", () => {
39+
if (process.platform !== "darwin") {
40+
app.quit();
3841
}
39-
})
42+
});
4043

41-
app.on('activate', () => {
44+
app.on("activate", () => {
4245
if (mainWindow === null) {
43-
createWindow()
46+
createWindow();
4447
}
45-
})
48+
});

src/components/CodeSnippet.vue

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
22
<div class="codesnippet-container">
33
<!-- <input type="checkbox" v-model="lineNumbers"> Linenumbers -->
4-
<div class="top-p" v-if="activeComponent === ''" >Select a component</div>
5-
<div v-else >{{ `${activeComponent}.vue` }}</div>
4+
<div class="top-p" v-if="activeComponent === ''">Select a component</div>
5+
<div v-else>{{ `${activeComponent}.vue` }}</div>
66
<prism-editor
77
v-model="code"
88
language="js"
@@ -44,7 +44,10 @@ export default {
4444
},
4545
// calls createTemplate and createBoiler to generate snippet
4646
createCodeSnippet (componentName, children) {
47-
let result = `${this.createTemplate(componentName, children)}${this.createBoiler(componentName, children)}`
47+
let result = `${this.createTemplate(
48+
componentName,
49+
children
50+
)}${this.createBoiler(componentName, children)}`
4851
return result
4952
},
5053
createTemplate (componentName, children) {
@@ -108,7 +111,10 @@ export default {
108111
// updates code snippet, but broken cause children undefined, shows `function () { [native code] }`
109112
updated () {
110113
// console.log(`code: ${this.createCodeSnippet(this.activeComponent, this.componentMap[this.activeComponent].children)}`)
111-
this.code = `${this.createCodeSnippet(this.activeComponent, this.componentMap[this.activeComponent].children)}`
114+
this.code = `${this.createCodeSnippet(
115+
this.activeComponent,
116+
this.componentMap[this.activeComponent].children
117+
)}`
112118
},
113119
beforeDestroy () {
114120
window.removeEventListener('resize', this.getWindowHeight)
@@ -121,11 +127,12 @@ export default {
121127
.code-editor {
122128
font-size: 12px;
123129
}
130+
124131
.codesnippet-container {
125132
margin-bottom: 1rem;
126133
}
134+
127135
::-webkit-scrollbar {
128-
display: none;
136+
display: none;
129137
}
130-
131138
</style>

src/components/ComponentDisplay.vue

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<div class="component-display">
2+
<div class="component-display grid-bg" :style="mockBg">
3+
<!-- <p>{{ userImage }}</p> -->
34
<VueDraggableResizable
45
class-name="component-box"
56
v-for="componentData in activeRouteArray"
@@ -15,23 +16,27 @@
1516
@resizing="onResize"
1617
@dblclick.native="onDoubleClick(componentData)"
1718
>
18-
<div class="component-title">
19+
<div class="component-title">
1920
<p>{{ componentData.componentName }}</p>
2021
</div>
2122
<ul class="component-children">
22-
<li># of children: {{ componentMap[componentData.componentName].children.length }} </li>
23+
<li># of children: {{ componentMap[componentData.componentName].children.length }}</li>
2324
<li>children: {{ componentMap[componentData.componentName].children }}</li>
24-
<!-- <p v-for="child in childList" :key="childList.indexOf(child)"> {{ child.text }}</p> -->
25+
<!-- <p v-for="child in childList" :key="childList.indexOf(child)"> {{ child.text }}</p> -->
2526
</ul>
26-
<q-menu context-menu >
27+
<q-menu context-menu>
2728
<q-list class="menu">
2829
<q-item clickable v-ripple v-close-popup @click="handleAddChild">
2930
<q-item-section>Add Children</q-item-section>
30-
<q-item-section avatar><q-icon color="primary" name="add"/></q-item-section>
31+
<q-item-section avatar>
32+
<q-icon color="primary" name="add" />
33+
</q-item-section>
3134
</q-item>
3235
<q-item clickable v-ripple v-close-popup auto-close>
3336
<q-item-section>Delete Children</q-item-section>
34-
<q-item-section avatar><q-icon color="primary" name="delete"/></q-item-section>
37+
<q-item-section avatar>
38+
<q-icon color="primary" name="delete" />
39+
</q-item-section>
3540
</q-item>
3641
</q-list>
3742
</q-menu>
@@ -70,7 +75,8 @@ export default {
7075
modalOpen: false,
7176
abilityToDelete: false,
7277
testOptions: ['parent', 'child', 'grandchild'],
73-
testModel: []
78+
testModel: [],
79+
mockImg: false
7480
}
7581
},
7682
mounted () {
@@ -85,7 +91,14 @@ export default {
8591
})
8692
},
8793
computed: {
88-
...mapState(['routes', 'activeRoute', 'activeComponent', 'componentMap', 'componentChildrenMultiselectValue']),
94+
...mapState([
95+
'routes',
96+
'activeRoute',
97+
'activeComponent',
98+
'componentMap',
99+
'componentChildrenMultiselectValue',
100+
'imagePath'
101+
]),
89102
// used in VueDraggableResizeable component
90103
activeRouteArray () {
91104
console.log('active route array method', this.routes[this.activeRoute])
@@ -107,13 +120,28 @@ export default {
107120
return Object.keys(this.componentMap).filter(component => {
108121
if (!exceptions.has(component)) return component
109122
})
123+
},
124+
userImage () {
125+
const imgSrc = this.imagePath.length ? `file://` + this.imagePath[0] : ''
126+
// const imgSrc1 = this.imagePath;
127+
console.log(`imgSrc: ${imgSrc}`)
128+
return imgSrc
129+
},
130+
mockBg () {
131+
return this.imagePath.length
132+
? {
133+
background: `url("${this.userImage}") no-repeat center`,
134+
'background-size': 'cover'
135+
}
136+
: {}
110137
}
111138
},
112139
methods: {
113140
...mapActions([
114141
'setActiveComponent',
115142
'updateComponentChildrenMultiselectValue',
116-
'updateActiveComponentChildrenValue']),
143+
'updateActiveComponentChildrenValue'
144+
]),
117145
onResize: function (x, y, width, height) {
118146
this.activeComponentData.x = x
119147
this.activeComponentData.y = y
@@ -131,6 +159,7 @@ export default {
131159
132160
this.componentMap[this.activeComponent].x = x
133161
this.componentMap[this.activeComponent].y = y
162+
this.userImage
134163
},
135164
onActivated (componentData) {
136165
this.setActiveComponent(componentData.componentName)
@@ -190,8 +219,10 @@ export default {
190219
height: 90vh;
191220
width: 100%;
192221
position: relative;
193-
background: darkslategray;
194-
background-color: rgba(124, 126, 145, 0.44);
222+
/* background: rgb(211, 211, 210); */
223+
}
224+
.grid-bg {
225+
background-color: rgba(223, 218, 218, 0.886);
195226
/* background-color: #269; */
196227
background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
197228
background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
@@ -216,6 +247,7 @@ export default {
216247
#269;
217248
behavior: url(/pie/PIE.htc);
218249
}
250+
219251
.menu {
220252
margin-bottom: 0px !important;
221253
}

src/components/CreateComponent.vue

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,25 @@
1010
label="Component Name"
1111
:dense="dense"
1212
class="input-add"
13-
>
14-
</q-input>
13+
></q-input>
1514
</form>
1615
<div class="icon-container">
17-
<Icons class = 'icons' @getClickedIcon="addToSelectedElementList" @activeElement="addToComponentElementList"/>
16+
<Icons
17+
class="icons"
18+
@getClickedIcon="addToSelectedElementList"
19+
@activeElement="addToComponentElementList"
20+
/>
1821
</div>
1922
<ParentMultiselect />
2023
<br />
2124

22-
<q-btn id="add-component-btn" color="secondary" label="Create Component" @click="handleClick" :disabled="!componentNameInputValue" />
23-
25+
<q-btn
26+
id="add-component-btn"
27+
color="secondary"
28+
label="Create Component"
29+
@click="handleClick"
30+
:disabled="!componentNameInputValue"
31+
/>
2432
</div>
2533
</template>
2634

@@ -78,7 +86,7 @@ export default {
7886
}
7987
}
8088
</script>
81-
<style scoped>
89+
<style type="stylus" scoped>
8290
.is-primary {
8391
height: 45px;
8492
}
@@ -93,7 +101,7 @@ form {
93101
.home-sidebar {
94102
margin: 1rem;
95103
padding: 0.5rem;
96-
border: 1px solid rgba(215, 215, 215, 0.728);
104+
/* border: 1px solid $subsecondary; */
97105
border-radius: 5px;
98106
}
99107
</style>

src/components/Footer.vue

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,36 +43,36 @@
4343
</template>
4444

4545
<script>
46-
import Tree from "./Tree";
47-
import HomeQueue from "./HomeQueue";
48-
import CodeSnippet from "./CodeSnippet";
46+
import Tree from './Tree'
47+
import HomeQueue from './HomeQueue'
48+
import CodeSnippet from './CodeSnippet'
4949
5050
export default {
5151
components: {
5252
Tree,
5353
HomeQueue,
5454
CodeSnippet
5555
},
56-
data() {
56+
data () {
5757
return {
58-
tab: "code",
58+
tab: 'code',
5959
open: true,
6060
height: 40,
61-
up: "fas fa-chevron-up",
62-
down: "fas fa-chevron-down"
63-
};
61+
up: 'fas fa-chevron-up',
62+
down: 'fas fa-chevron-down'
63+
}
6464
},
6565
methods: {
66-
openBottomDrawer() {
66+
openBottomDrawer () {
6767
// 15in mb pro - 1027 px 3.75
6868
// big ass screens 2.5
6969
let minHeight =
70-
window.outerHeight < 900 ? 4.5 : window.outerHeight < 1035 ? 3.75 : 2.5;
71-
this.height === 40 ? (this.height = minHeight) : (this.height = 40);
72-
this.open === true ? (this.open = false) : (this.open = true);
70+
window.outerHeight < 900 ? 4.5 : window.outerHeight < 1035 ? 3.75 : 2.5
71+
this.height === 40 ? (this.height = minHeight) : (this.height = 40)
72+
this.open === true ? (this.open = false) : (this.open = true)
7373
}
7474
}
75-
};
75+
}
7676
</script>
7777

7878
<style lang="stylus" scoped>
@@ -92,7 +92,7 @@ i {
9292
transition-timing-function: ease-in;
9393
transition: 0.2s;
9494
// background: #313131;
95-
background: #272822;
95+
background: $subsecondary;
9696
}
9797
9898
// changes the footer toolbar height
@@ -124,7 +124,7 @@ i {
124124
125125
.q-tab-panel {
126126
// matchs the code editor bg
127-
background: #272822;
127+
background: $subprimary;
128128
// background: rgb(69,77,102);
129129
// background: linear-gradient(180deg, rgba(69,77,102,1) 0%, rgba(54,60,78,1) 100%);
130130
}

0 commit comments

Comments
 (0)