-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 2376-icon
- Loading branch information
Showing
41 changed files
with
483 additions
and
244 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/desktop/lib/electron/interfaces/electron-settings.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { IWindowState } from './window-state.interface' | ||
|
||
export interface IElectronSettings { | ||
windowState: IWindowState | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './electron-settings.interface' | ||
export * from './window-state.interface' |
11 changes: 11 additions & 0 deletions
11
packages/desktop/lib/electron/interfaces/window-state.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { BrowserWindow } from 'electron' | ||
|
||
export interface IWindowState { | ||
x?: number | ||
y?: number | ||
width: number | ||
height: number | ||
isMaximized?: boolean | ||
|
||
track?(window: BrowserWindow): void | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/desktop/lib/electron/managers/electron-settings.manager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { JsonFileManager } from './json-file.manager' | ||
import { IElectronSettings } from '../interfaces' | ||
|
||
const SETTINGS_FILE_NAME = 'settings.json' | ||
|
||
export class ElectronSettingsManager { | ||
public static saveSettings(settings: IElectronSettings): void { | ||
JsonFileManager.saveJsonToFile(SETTINGS_FILE_NAME, settings) | ||
} | ||
|
||
public static loadSettings(): IElectronSettings { | ||
const settings = JsonFileManager.loadJsonFromFile(SETTINGS_FILE_NAME) as IElectronSettings | undefined | ||
return settings ? settings : { windowState: { width: 800, height: 600 } } | ||
} | ||
|
||
public static updateSettings(settings: IElectronSettings): void { | ||
const config = ElectronSettingsManager.loadSettings() | ||
ElectronSettingsManager.saveSettings({ ...config, ...settings }) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/desktop/lib/electron/managers/json-file.manager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { IError } from '@core/error/interfaces' | ||
import { app } from 'electron' | ||
import fs from 'fs' | ||
import path from 'path' | ||
|
||
export class JsonFileManager { | ||
public static saveJsonToFile(filename: string, data: object): void { | ||
try { | ||
fs.writeFileSync(JsonFileManager.getFilePath(filename), JSON.stringify(data)) | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
} | ||
|
||
public static loadJsonFromFile(filename: string): object | undefined { | ||
try { | ||
return JSON.parse(fs.readFileSync(JsonFileManager.getFilePath(filename)).toString()) | ||
} catch (err) { | ||
if (!(err as IError).message?.includes('ENOENT')) { | ||
console.error(err) | ||
} | ||
} | ||
} | ||
|
||
private static getFilePath(filename: string): string { | ||
const userDataPath = app.getPath('userData') | ||
return path.join(userDataPath, filename) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/desktop/views/dashboard/collectibles/components/CollectiblesTabs.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script lang="ts"> | ||
import { Tabs } from '@bloomwalletio/ui' | ||
import { COLLECTIBLES_TABS } from '@core/nfts' | ||
import { selectedCollectiblesTab } from '@core/nfts/stores' | ||
const selectedIndex = COLLECTIBLES_TABS.findIndex((tab) => tab.key === $selectedCollectiblesTab?.key) | ||
</script> | ||
|
||
{#if COLLECTIBLES_TABS.length > 1} | ||
<div class="w-64"> | ||
<Tabs {selectedIndex} bind:selectedTab={$selectedCollectiblesTab} tabs={COLLECTIBLES_TABS} /> | ||
</div> | ||
{/if} |
3 changes: 2 additions & 1 deletion
3
packages/desktop/views/dashboard/collectibles/components/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as Irc27CollectibleDetails } from './Irc27CollectibleDetails.svelte' | ||
export { default as CollectiblesTabs } from './CollectiblesTabs.svelte' | ||
export { default as Erc721CollectibleDetails } from './Erc721CollectibleDetails.svelte' | ||
export { default as Irc27CollectibleDetails } from './Irc27CollectibleDetails.svelte' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
packages/desktop/views/dashboard/collectibles/views/CollectionsGalleryView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<script lang="ts"> | ||
import { Button, IconName, Pill, Text } from '@bloomwalletio/ui' | ||
import { CollectiblesListMenu, EmptyListPlaceholder } from '@components' | ||
import { Filter } from '@components/filter' | ||
import { localize } from '@core/i18n' | ||
import { PopupId, openPopup } from '@desktop/auxiliary/popup' | ||
import features from '@features/features' | ||
import { SearchInput } from '@ui' | ||
import { writable } from 'svelte/store' | ||
import { CollectiblesTabs } from '../components' | ||
function onReceiveClick(): void { | ||
openPopup({ | ||
id: PopupId.ReceiveAddress, | ||
}) | ||
} | ||
// MOCKS | ||
const collections: { name: string }[] = [] | ||
let collectionSearchTerm = '' | ||
const collectionFilter = writable(undefined) | ||
const ownedCollections = collections | ||
let queriedCollections: typeof collections = [] | ||
$: collectionSearchTerm, | ||
$collectionFilter, | ||
(queriedCollections = ownedCollections | ||
.filter((collection) => collection) | ||
.sort((collection1, collection2) => | ||
collection1.name.toLowerCase().localeCompare(collection2.name.toLowerCase()) | ||
)) | ||
</script> | ||
|
||
<collections-gallery-view class="flex flex-col w-full h-full gap-4"> | ||
<header class="flex flex-row items-center justify-between"> | ||
<div class="flex flex-row text-left gap-2 items-center flex-1"> | ||
<Text type="h6">{localize('views.collectibles.collectionsGallery.title')}</Text> | ||
<Pill color="neutral"> | ||
<Text textColor="secondary">{String(queriedCollections.length ?? '')}</Text> | ||
</Pill> | ||
</div> | ||
<CollectiblesTabs /> | ||
<div class="flex justify-end items-center gap-5 h-10 shrink-0 flex-1"> | ||
{#if collections.length} | ||
<SearchInput bind:value={collectionSearchTerm} /> | ||
<Filter filterStore={collectionFilter} /> | ||
{/if} | ||
{#if features.collectibles.erc721.enabled} | ||
<CollectiblesListMenu /> | ||
{/if} | ||
</div> | ||
</header> | ||
{#if collections.length} | ||
{#if queriedCollections.length} | ||
<!-- <CollectionsGallery collections={queriedCollections} /> --> | ||
{:else} | ||
<div class="w-full h-full flex flex-col items-center justify-center"> | ||
<EmptyListPlaceholder | ||
title={localize('views.collectibles.collectionsGallery.noResults')} | ||
icon={IconName.Data} | ||
/> | ||
</div> | ||
{/if} | ||
{:else} | ||
<div class="w-full h-full flex flex-col items-center justify-center grow-1 gap-6"> | ||
<EmptyListPlaceholder | ||
title={localize('views.collectibles.collectionsGallery.emptyTitle')} | ||
subtitle={localize('views.collectibles.collectionsGallery.emptyDescription')} | ||
icon={IconName.Data} | ||
/> | ||
<Button text={localize('actions.getStarted')} on:click={onReceiveClick} /> | ||
</div> | ||
{/if} | ||
</collections-gallery-view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as CollectiblesDetailsView } from './CollectiblesDetailsView.svelte' | ||
export { default as CollectiblesGalleryView } from './CollectiblesGalleryView.svelte' | ||
export { default as CollectionsGalleryView } from './CollectionsGalleryView.svelte' |
Oops, something went wrong.