Skip to content

Commit

Permalink
Add notifications to greet screen
Browse files Browse the repository at this point in the history
  • Loading branch information
outercloudstudio committed May 21, 2024
1 parent 5fc2c2f commit 142fc9f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import { InformationWindow } from '/@/components/Windows/Common/Information/Info
import { BottomPanel } from '/@/components/BottomPanel/BottomPanel'
import { SolidWindowManager } from './components/Solid/Window/Manager'
import { setupActions } from './components/Actions/Actions'
import { createNotification } from './components/Notifications/create'

if (import.meta.env.VITE_IS_TAURI_APP) {
// Import Tauri updater for native builds
Expand Down Expand Up @@ -275,10 +276,7 @@ export class App {
`--- Running bridge. ${appVersion} on a "${platform()}" machine ---`
)
console.time('[APP] beforeStartUp()')
// @ts-expect-error
if (navigator.clearAppBadge)
// @ts-expect-error
navigator.clearAppBadge()
if (navigator.clearAppBadge) navigator.clearAppBadge()

Check failure on line 279 in src/App.ts

View workflow job for this annotation

GitHub Actions / check

Property 'clearAppBadge' does not exist on type 'Navigator'.

Check failure on line 279 in src/App.ts

View workflow job for this annotation

GitHub Actions / check

Property 'clearAppBadge' does not exist on type 'Navigator'.

setupSidebar()
setupDefaultMenus(this)
Expand Down
44 changes: 43 additions & 1 deletion src/components/Greet/Greet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="d-flex flex-column projects-container">
<Logo
style="height: 160px; width: 160px"
class="ml-auto mr-auto mb-24 -mt-24"
class="ml-auto mr-auto mb-20 -mt-36"
alt="Logo of bridge. v2"
/>

Expand Down Expand Up @@ -172,16 +172,54 @@
{{ t('windows.settings.general.selectBridgeFolder.name') }}
</p>
</div>

<div class="flex">
<SidebarButton
v-for="notification in NotificationStore"
v-if="notification.isVisible"
:key="notification.id"
:displayName="notification.message"
:icon="notification.icon"
:color="notification.color"
:iconColor="notification.textColor"
@click="notification.onClick()"
@middleClick="notification.onMiddleClick()"
/>

<SidebarButton
v-for="(task, i) in tasks"
:key="`${i}`"
:displayName="task.name"
:icon="task.icon"
color="primary"
isLoading
alwaysAllowClick
@click="task.createWindow()"
>
<v-progress-circular
rotate="-90"
size="24"
width="2"
color="white"
:indeterminate="task.progress === undefined"
:value="task.progress"
/>
</SidebarButton>
</div>
</div>
</main>
</template>

<script setup lang="ts">
import Logo from '/@/components/UIElements/Logo.vue'
import SidebarButton from '/@/components/Sidebar/Button.vue'
import { App } from '/@/App'
import { computed, onMounted, onUnmounted, Ref, ref } from 'vue'
import { useTranslations } from '/@/components/Composables/useTranslations'
import { isUsingFileSystemPolyfill } from '/@/components/FileSystem/Polyfill'
import { NotificationStore } from '/@/components/Notifications/state'
import { tasks } from '/@/components/TaskManager/TaskManager'
const tauri = import.meta.env.VITE_IS_TAURI_APP
Expand Down Expand Up @@ -267,6 +305,10 @@ async function pin(project: any) {
await saveProjects()
}
const hasVisibleNotifications = computed(() => {
return Object.values(NotificationStore).some(({ isVisible }) => isVisible)
})
onMounted(async () => {
loadProjects()
Expand Down
4 changes: 1 addition & 3 deletions src/components/Notifications/Notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface INotificationConfig {
}

export class Notification {
protected id: string
public id: string
protected _isVisible: boolean = false

constructor(protected config: INotificationConfig) {
Expand Down Expand Up @@ -69,9 +69,7 @@ export class Notification {
}

protected updateAppBadge() {
// @ts-expect-error
if (typeof navigator.setAppBadge === 'function')

Check failure on line 72 in src/components/Notifications/Notification.ts

View workflow job for this annotation

GitHub Actions / check

Property 'setAppBadge' does not exist on type 'Navigator'.
// @ts-expect-error
navigator.setAppBadge(

Check failure on line 73 in src/components/Notifications/Notification.ts

View workflow job for this annotation

GitHub Actions / check

Property 'setAppBadge' does not exist on type 'Navigator'.
Object.values(NotificationStore).filter(
({ isVisible }) => isVisible
Expand Down
1 change: 1 addition & 0 deletions src/components/Sidebar/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
transform: isSelected ? 'scale(1.1)' : undefined,
cursor: canInteractWith ? 'pointer' : undefined,
height: smallerSidebarElements ? `34px` : `40px`,
width: smallerSidebarElements ? `34px` : `40px`,
}"
:class="{
loading: isLoading,
Expand Down

0 comments on commit 142fc9f

Please sign in to comment.