Skip to content

Commit

Permalink
Support more than 5 tabs. (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
its-saeed authored Jun 13, 2024
1 parent 05333d2 commit e845986
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 36 deletions.
70 changes: 40 additions & 30 deletions src/pages/EditorPage.vue
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
<template>
<q-page class="column">
<q-tabs
v-model="tab"
dense
class="bg-grey-2"
active-class="bg-grey-4"
active-color="grey-10"
indicator-color="orange"
align="left"
no-caps
switch-indicator
@update:model-value="updateSelectedFile"
<q-scroll-area
class="full-width"
style="height: 38px"
:thumb-style="thumbStyle"
>
<q-tab
class="q-pa-none q-pl-sm"
v-for="file in filesStore.openFiles"
:name="file"
:key="file"
<q-tabs
v-model="tab"
dense
class="bg-grey-2"
active-class="bg-grey-4"
active-color="grey-10"
indicator-color="orange"
align="left"
no-caps
@update:model-value="updateSelectedFile"
>
<div class="row items-center">
{{ file }}
<q-btn
round
dense
flat
icon="close"
size="xs"
class="q-ml-xs"
@click="closeFile(file)"
/>
</div>
</q-tab>
</q-tabs>
<q-tab
class="q-pa-none q-pl-sm"
v-for="file in filesStore.openFiles"
:name="file"
:key="file"
>
<div class="items-center">
{{ file }}
<q-btn
round
dense
flat
icon="close"
size="xs"
class="q-ml-xs"
@click="closeFile(file)"
/>
</div>
</q-tab>
</q-tabs>
</q-scroll-area>
<q-separator color="grey-4" />

<div
Expand Down Expand Up @@ -64,6 +69,11 @@ const closeFile = (file: string) => {
console.log(tab.value);
};
const thumbStyle = {
backgroundColor: 'grey-1',
height: '5px',
};
onMounted(() => {
eventBus.on('scilla-file-selected', (file: ScillaFile) => {
tab.value = file.name;
Expand Down
6 changes: 0 additions & 6 deletions src/stores/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ export const useFilesStore = defineStore('files', {
return; // File already added
}

if (this.openFiles.length === 5) {
throw new Error(
'We only support 5 open files. Close one of your files!'
);
}

this.openFiles.push(name);
},
setSelected(name: string) {
Expand Down

0 comments on commit e845986

Please sign in to comment.