Skip to content

Commit

Permalink
preparing release (pw)
Browse files Browse the repository at this point in the history
  • Loading branch information
evandor committed Dec 13, 2024
1 parent ae78bf4 commit 11eb02e
Show file tree
Hide file tree
Showing 17 changed files with 316 additions and 424 deletions.
30 changes: 18 additions & 12 deletions src/app/BrowserApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Tabset} from "src/tabsets/models/Tabset";
import {CLEANUP_PERIOD_IN_MINUTES, GITHUB_AUTO_BACKUP, MONITORING_PERIOD_IN_MINUTES} from "boot/constants";
import _ from "lodash"
import NavigationService from "src/services/NavigationService";
import IndexedDbPersistenceService from "src/services/IndexedDbPersistenceService";
import {Tab} from "src/tabsets/models/Tab";
import {LocalStorage, uid} from "quasar";
import {FeatureIdent} from "src/app/models/FeatureIdent";
Expand All @@ -14,7 +13,6 @@ import {useFeaturesStore} from "src/features/stores/featuresStore";
import {useCommandExecutor} from "src/core/services/CommandExecutor";
import {GithubBackupCommand} from "src/tabsets/commands/github/GithubBackupCommand";
import {useRequestsService} from "src/requests/services/RequestsService";
import {useContentStore} from "src/content/stores/contentStore";
import {useRequestsStore} from "src/requests/stores/requestsStore";


Expand Down Expand Up @@ -186,12 +184,12 @@ class BrowserApi {

if (allTabsets.length > 15) {
const result = _(allTabsets)
.groupBy((o:any) => (o.name && o.name.length > 0) ? o.name[0].toUpperCase() : ' ')
.map((tabsets:any, firstLetter:any) => ({firstLetter, tabsets}))
.sortBy((r:any) => r.firstLetter)
.groupBy((o: any) => (o.name && o.name.length > 0) ? o.name[0].toUpperCase() : ' ')
.map((tabsets: any, firstLetter: any) => ({firstLetter, tabsets}))
.sortBy((r: any) => r.firstLetter)
.value();

_.forEach(result, (r:any) => {
_.forEach(result, (r: any) => {
chrome.contextMenus.create({
id: 'save_as_tab_folder|' + r.firstLetter,
parentId: 'tabset_extension',
Expand Down Expand Up @@ -296,14 +294,14 @@ class BrowserApi {
focused: true,
left: 50,
top: 50,
url: _.map(urlAndGroupArray, (a:any) => a['url' as keyof object])
url: _.map(urlAndGroupArray, (a: any) => a['url' as keyof object])
})
} else if (windowName) { // open in named window
useTabsetsStore().selectCurrentTabset(tabset.id)
NavigationService.openOrCreateTab(
_.map(urlAndGroupArray, (a:any) => a['url' as keyof object]),
_.map(urlAndGroupArray, (a: any) => a['url' as keyof object]),
undefined,
_.map(urlAndGroupArray, (a:any) => a['group' as keyof object]))
_.map(urlAndGroupArray, (a: any) => a['group' as keyof object]))
// TODO deactivate listeners - needed?
// useTabsStore().deactivateListeners()
// this.getCurrentTab()
Expand All @@ -313,8 +311,8 @@ class BrowserApi {
// })
} else {
console.log("opening urls", urlAndGroupArray)
NavigationService.openOrCreateTab(_.map(urlAndGroupArray, (a:any) => a['url' as keyof object]),
undefined, _.map(urlAndGroupArray, (a:any) => a['group' as keyof object]))
NavigationService.openOrCreateTab(_.map(urlAndGroupArray, (a: any) => a['url' as keyof object]),
undefined, _.map(urlAndGroupArray, (a: any) => a['group' as keyof object]))
}
}

Expand Down Expand Up @@ -344,7 +342,7 @@ class BrowserApi {

async childrenFor(bookmarkFolderId: string): Promise<chrome.bookmarks.BookmarkTreeNode[]> {
console.log("bookmarkFolderId", bookmarkFolderId)
return chrome.bookmarks.getChildren(""+bookmarkFolderId)
return chrome.bookmarks.getChildren("" + bookmarkFolderId)
}

createChromeTabObject(title: string, url: string, favIconUrl: string = "https://tabsets.web.app/icons/favicon-128x128.png") {
Expand Down Expand Up @@ -523,6 +521,14 @@ class BrowserApi {
}

}

async closeAllTabs(includingPinnedOnes: boolean = true) {
const tabIds = (await chrome.tabs.query({}))
.filter((t: chrome.tabs.Tab) => includingPinnedOnes ? true : !t.pinned)
.map((t: chrome.tabs.Tab) => t.id || 0)
await chrome.tabs.create({})
await chrome.tabs.remove(tabIds)
}
}

export default new BrowserApi();
Expand Down
8 changes: 4 additions & 4 deletions src/app/models/AppFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ export class AppFeatures {
'The "RSS View" list all your RSS Pages. It is recommended to enable the "analyse Tabs" feature as well to automatically find linked rss feeds from your tabsets.',
'o_rss_feed', 'rss.png', ['bex', 'spa']),

new Feature(FeatureIdent.SESSIONS, FeatureType.DISABLED,
new Feature(FeatureIdent.SESSIONS, FeatureType.EXPERIMENTAL,
'Sessions',
'A session is a special type of tabsets where your newly opened tabs will be tracked automatically',
'o_explore', '', ['all']),
'You want to start something in-between without losing your already opened tabs? Start a new session and come back to your old tabs whenever needed.',
'sym_o_new_window', '', ['all']),

new Feature(FeatureIdent.SPACES, FeatureType.OPTIONAL,
'Spaces',
Expand Down Expand Up @@ -186,7 +186,7 @@ export class AppFeatures {
'Drag and drop Text and Images to the sidebar to create Website Snippets',
'text_snippet', '', ['bex']),

new Feature(FeatureIdent.TABSET_LIST, FeatureType.OPTIONAL,
new Feature(FeatureIdent.TABSET_LIST, FeatureType.EXPERIMENTAL,
'List of recent Tabsets',
'Switch beetween recent and favorite tabsets quickly',
'list', '', ['bex']),
Expand Down
99 changes: 75 additions & 24 deletions src/components/SidePanelFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@
class="q-pa-none q-mt-sm darkInDarkMode brightInBrightMode" style="border-top: 1px solid lightgrey;"
:style="offsetBottom()">

<template v-if="checkToasts()" class="q-ma-xs q-pa-xs">
<Transition name="fade" appear>
<q-banner
inline-actions dense rounded
style="font-size: smaller;text-align: center"
:class="toastBannerClass()">
{{ useUiStore().toasts[0]?.msg }}
<template v-slot:action v-if="useUiStore().toasts[0]?.actions[0]">
<q-btn flat :label="useUiStore().toasts[0].actions[0].label"
@click="useUiStore().callUndoActionFromCurrentToast()"/>
</template>
</q-banner>
</Transition>
</template>

<template v-if="useFeaturesStore().hasFeature(FeatureIdent.TABSET_LIST)">
<SidePanelTabsetListMarkup />
<SidePanelTabsetListMarkup/>
</template>

<div class="row fit q-mb-sm" v-if="showWindowTable">
Expand Down Expand Up @@ -38,21 +53,21 @@
<div class="row fit q-ma-none q-pa-none">
<div class="col-6">

<Transition name="fade" appear>
<q-banner
v-if="checkToasts()"
inline-actions dense rounded
style="font-size: smaller;text-align: center"
:class="toastBannerClass()">
{{ useUiStore().toasts[0]?.msg }}
<template v-slot:action v-if="useUiStore().toasts[0]?.actions[0]">
<q-btn flat :label="useUiStore().toasts[0].actions[0].label"
@click="useUiStore().callUndoActionFromCurrentToast()"/>
</template>
</q-banner>
</Transition>

<q-btn v-if="!checkToasts() && !transitionGraceTime && showSuggestionButton"
<!-- <Transition name="fade" appear>-->
<!-- <q-banner-->
<!-- v-if="checkToasts()"-->
<!-- inline-actions dense rounded-->
<!-- style="font-size: smaller;text-align: center"-->
<!-- :class="toastBannerClass()">-->
<!-- {{ useUiStore().toasts[0]?.msg }}-->
<!-- <template v-slot:action v-if="useUiStore().toasts[0]?.actions[0]">-->
<!-- <q-btn flat :label="useUiStore().toasts[0].actions[0].label"-->
<!-- @click="useUiStore().callUndoActionFromCurrentToast()"/>-->
<!-- </template>-->
<!-- </q-banner>-->
<!-- </Transition>-->

<q-btn v-if="!transitionGraceTime && showSuggestionButton"
outline
icon="o_lightbulb"
:label="suggestionsLabel()"
Expand All @@ -62,8 +77,7 @@
class="q-ma-none q-pa-xs q-ml-sm q-mt-xs q-pr-md cursor-pointer">
</q-btn>

<template v-if="!checkToasts() && !transitionGraceTime && !showSuggestionButton">

<template v-if="!transitionGraceTime && !showSuggestionButton">
<SidePanelFooterLeftButtons
@was-clicked="doShowSuggestionButton = true"
:size="getButtonSize()"
Expand Down Expand Up @@ -122,6 +136,20 @@
icon="o_open_in_new"
label="Issues"/>

<template v-if="useFeaturesStore().hasFeature(FeatureIdent.SESSIONS)">

<q-separator/>

<ContextMenuItem
:disable="useTabsetsStore().getCurrentTabset?.type!==TabsetType.DEFAULT"
v-close-popup
@was-clicked="startSession()"
color="warning"
icon="sym_o_new_window"
label="Start new Session..."/>

</template>

<q-separator/>

<ContextMenuItem
Expand Down Expand Up @@ -206,7 +234,7 @@ import {useSuggestionsStore} from "src/suggestions/stores/suggestionsStore";
import _ from "lodash";
import {Suggestion, SuggestionState} from "src/suggestions/models/Suggestion";
import SuggestionDialog from "src/suggestions/dialogues/SuggestionDialog.vue";
import {Tabset, TabsetStatus} from "src/tabsets/models/Tabset";
import {Tabset, TabsetType} from "src/tabsets/models/Tabset";
import {ToastType} from "src/core/models/Toast";
import SidePanelFooterLeftButtons from "components/helper/SidePanelFooterLeftButtons.vue";
import {useAuthStore} from "stores/authStore";
Expand All @@ -229,12 +257,13 @@ import BrowserApi from "src/app/BrowserApi";
import {useContentStore} from "src/content/stores/contentStore";
import ContextMenuItem from "src/core/components/helper/ContextMenuItem.vue";
import {useTabsetsUiStore} from "../tabsets/stores/tabsetsUiStore";
import {useTabsetService} from "src/tabsets/services/TabsetService2";
import {MarkTabsetAsFavoriteCommand} from "src/tabsets/commands/MarkTabsetAsFavorite";
import {MarkTabsetAsDefaultCommand} from "src/tabsets/commands/MarkTabsetAsDefault";
import SidePanelTabsetListMarkup from "components/helper/SidePanelTabsetListMarkup.vue";
import StartSessionDialog from "src/tabsets/dialogues/StartSessionDialog.vue";
import {CreateTabsetCommand} from "src/tabsets/commands/CreateTabsetCommand";
import {ExecutionResult} from "src/core/domain/ExecutionResult";
import {SaveOrReplaceResult} from "src/tabsets/models/SaveOrReplaceResult";
const {handleSuccess, handleError} = useNotificationHandler()
const {handleError} = useNotificationHandler()
const {inBexMode} = useUtils()
Expand Down Expand Up @@ -531,7 +560,6 @@ const additionalActionWasClicked = (event: any) => {
}
const offsetBottom = () => ($q.platform.is.capacitor || $q.platform.is.cordova) ? 'margin-bottom:20px;' : ''
const openPwaUrl = () => NavigationService.openOrCreateTab([process.env.TABSETS_PWA_URL || 'https://www.skysail.io'])
const showSettingsButton = () => route?.path !== '/sidepanel/welcome' || useAuthStore().isAuthenticated
const drop = (evt: any) => {
Expand Down Expand Up @@ -560,6 +588,29 @@ const drop = (evt: any) => {
const reload = () => window.location.reload()
const startSession = () => {
$q.dialog({
component: StartSessionDialog
}).onOk((callback: object) => {
console.log("callback", callback)
const tabsToUse = useTabsStore2().browserTabs
useCommandExecutor()
.execute(new CreateTabsetCommand(callback['oldSessionName' as keyof object], tabsToUse))
.then((res: ExecutionResult<SaveOrReplaceResult>) => {
console.log("res", res.result.tabset)
const ts = res.result.tabset
ts.type = TabsetType.SESSION
useTabsetsStore().saveTabset(ts)
BrowserApi.closeAllTabs(false)
})
.then(() => {
useCommandExecutor()
.executeFromUi(new CreateTabsetCommand(callback['sessionName' as keyof object], []))
})
})
}
</script>

<style>
Expand Down
2 changes: 1 addition & 1 deletion src/content
17 changes: 6 additions & 11 deletions src/pages/SidePanelCollectionsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<!-- <q-icon v-else name="remove" color="white"/>-->
<!-- <span v-else class="q-ma-none q-ml-md" style="background-color:yellow"></span>-->
<span class="mtl-ml cursor-pointer" @click="handleTreeClick(node)">
<q-icon v-if="node.level == 0" name="o_tab" color="primary" class="q-mx-sm"/>
<q-icon v-if="node.level == 0 && node.type !== TabsetType.SESSION" name="o_tab" color="primary" class="q-mx-sm"/>
<q-icon v-else-if="node.level == 0 && node.type === TabsetType.SESSION" name="sym_o_new_window" color="secondary" class="q-mx-sm"/>
<q-icon v-else name="o_folder" color="warning" class="q-mx-sm"/>
{{ node.text }}
</span>
Expand All @@ -43,7 +44,7 @@ import {onMounted, onUnmounted, ref, watchEffect} from "vue";
import {useUiStore} from "src/ui/stores/uiStore";
import Analytics from "src/core/utils/google-analytics";
import {useI18n} from 'vue-i18n'
import {Tabset, TabsetStatus} from "src/tabsets/models/Tabset";
import {Tabset, TabsetStatus, TabsetType} from "src/tabsets/models/Tabset";
import _ from "lodash"
import {useTabsetsStore} from "src/tabsets/stores/tabsetsStore";
import {SelectTabsetCommand} from "src/tabsets/commands/SelectTabsetCommand";
Expand All @@ -61,7 +62,7 @@ import {DeleteTabsetFolderCommand} from "src/tabsets/commands/DeleteTabsetFolder
const {t} = useI18n({locale: navigator.language, useScope: "global"})
type NodeTreeObject = { text: string, id: string, tsId: string, level: number, url: string, children: NodeTreeObject[] }
type NodeTreeObject = { text: string, id: string, tsId: string, level: number, url: string, children: NodeTreeObject[], type: TabsetType }
const router = useRouter()
Expand All @@ -87,13 +88,6 @@ onUnmounted(() => {
})
const ondrop2 = (evt: any) => {
// console.log("===> evt", evt)
// console.log("===> dragNode2", dragContext.dragNode)
// console.log("===> startInfo2", dragContext.startInfo)
// console.log("===> startTree2", dragContext.startTree)
// console.log("===> targetInfo2", dragContext.targetInfo)
// console.log("===> targetTree2", dragContext.targetTree)
console.log("")
const dragged = dragContext?.dragNode?.data
const draggedTo = dragContext.targetInfo?.parent?.data
console.log("dragged: ", dragged)
Expand Down Expand Up @@ -180,7 +174,8 @@ function treeNodeFromNote(n: Tabset, rootId: string = n.id, level = 0): NodeTree
url: chrome.runtime.getURL(`/www/index.html#/mainpanel/notes/${n.id}`),
children: _.map(n.folders, (f: Tabset) => {
return treeNodeFromNote(f, rootId, level + 1)
})
}),
type: n.type
}
}
Expand Down
Loading

0 comments on commit 11eb02e

Please sign in to comment.