Skip to content

Commit

Permalink
Merge pull request #3 from TheNetsky/main
Browse files Browse the repository at this point in the history
Anilist | 1.1.0
  • Loading branch information
FaizanDurrani authored Mar 20, 2023
2 parents 780a18e + b999d9f commit 59c656d
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 136 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "extensions",
"version": "1.0.11",
"version": "1.1.0",
"description": "Default trackers for Paperback 0.8.",
"main": "lib/index.js",
"scripts": {
Expand Down
18 changes: 9 additions & 9 deletions src/Anilist/AlSettings.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { DUINavigationButton,
SourceStateManager } from '@paperback/types'
import {
DUINavigationButton,
SourceStateManager
} from '@paperback/types'

export const getdefaultStatus = async (stateManager: SourceStateManager): Promise<string[]> => {
return (await stateManager.retrieve('defaultStatus') as string[]) ?? ['NONE']
}

export const trackerSettings = (stateManager: SourceStateManager): DUINavigationButton => {
return App.createDUINavigationButton({
id: 'tracker_settings',
label: 'Tracker Settings',
form: App.createDUIForm({
onSubmit: async (values: any) => {
await Promise.all([
stateManager.store('defaultStatus', values.defaultStatus)
])
},
sections: () => {
return Promise.resolve([
App.createDUISection({
Expand All @@ -24,7 +23,8 @@ export const trackerSettings = (stateManager: SourceStateManager): DUINavigation
label: 'Default Status',
allowsMultiselect: false,
value: App.createDUIBinding({
get: () => getdefaultStatus(stateManager)
get: () => getdefaultStatus(stateManager),
set: async (newValue) => await stateManager.store('defaultStatus', newValue)
}),
labelResolver: async (value) => {
switch (value) {
Expand Down Expand Up @@ -53,4 +53,4 @@ export const trackerSettings = (stateManager: SourceStateManager): DUINavigation
}
})
})
}
}
Loading

0 comments on commit 59c656d

Please sign in to comment.