Skip to content

Commit 7a816bf

Browse files
authored
feat(gsoc): embed view of simulator (CircuitVerse#187)
1 parent 5c0661e commit 7a816bf

File tree

6 files changed

+518
-143
lines changed

6 files changed

+518
-143
lines changed

src/components/TabsBar/TabsBar.vue

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div id="tabsBar" class="noSelect pointerCursor">
2+
<div id="tabsBar" class="noSelect pointerCursor" :class="embedClass()">
33
<draggable
44
:key="updateCount"
55
v-model="SimulatorState.circuit_list"
@@ -20,14 +20,15 @@
2020
:key="element.id"
2121
style=""
2222
class="circuits toolbarButton"
23-
:class="element.focussed ? 'current' : ''"
23+
:class="tabsbarClasses(element)"
2424
draggable="true"
2525
@click="switchCircuit(element.id)"
2626
>
2727
<span class="circuitName noSelect">
2828
{{ truncateString(element.name, 18) }}
2929
</span>
3030
<span
31+
v-if="!isEmbed()"
3132
:id="element.id"
3233
class="tabsCloseButton"
3334
@click.stop="closeCircuit(element)"
@@ -37,7 +38,9 @@
3738
</div>
3839
</template>
3940
</draggable>
40-
<button @click="createNewCircuitScope()">&#43;</button>
41+
<button v-if="!isEmbed()" @click="createNewCircuitScope()">
42+
&#43;
43+
</button>
4144
</div>
4245
<!-- <MessageBox
4346
v-model="SimulatorState.dialogBox.create_circuit"
@@ -243,20 +246,61 @@ function dragOptions(): Object {
243246
}
244247
}
245248
246-
// TODO: fix class adding for embed @Arnabdaz
247-
function tabsbarClasses(id: number | string): string {
249+
function tabsbarClasses(e: any): string {
248250
let class_list = ''
249251
if ((window as any).embed) {
250252
class_list = 'embed-tabs'
251253
}
252-
if ((window as any).globalScope.id == id) {
254+
if (e.focussed) {
253255
class_list += ' current'
254256
}
255257
return class_list
256258
}
259+
260+
function embedClass(): string {
261+
if ((window as any).embed) {
262+
return 'embed-tabbar'
263+
}
264+
return ''
265+
}
266+
267+
function isEmbed(): boolean {
268+
return (window as any).embed
269+
}
257270
</script>
258271

259272
<style scoped>
273+
#tabsBar.embed-tabbar {
274+
background-color: transparent;
275+
}
276+
277+
#tabsBar.embed-tabbar .circuits {
278+
border: 1px solid var(--br-circuit);
279+
color: var(--text-circuit);
280+
background-color: var(--bg-tabs) !important;
281+
}
282+
283+
#tabsBar.embed-tabbar .circuits:hover {
284+
background-color: var(--bg-circuit) !important;
285+
}
286+
287+
#tabsBar.embed-tabbar .current {
288+
color: var(--text-circuit);
289+
background-color: var(--bg-circuit) !important;
290+
/* border: 1px solid var(--br-circuit-cur); */
291+
}
292+
293+
#tabsBar.embed-tabbar button {
294+
color: var(--text-panel);
295+
background-color: var(--primary);
296+
border: 1px solid var(--br-circuit-cur);
297+
}
298+
299+
#tabsBar.embed-tabbar button:hover {
300+
color: var(--text-panel);
301+
border: 1px solid var(--br-circuit-cur);
302+
}
303+
260304
.list-group {
261305
display: inline;
262306
}

0 commit comments

Comments
 (0)