From 348f650b991a7789db42511bc9881020182430df Mon Sep 17 00:00:00 2001 From: Cale McCollough Date: Thu, 22 Feb 2024 17:14:17 -0800 Subject: [PATCH] Abilities.Add: Can clock on and off to dummy log #29.A --- Extension/App/Popup.tsx | 19 +++++++---- Extension/Model/index.ts | 6 ++-- Extension/View/MissionSelector.tsx | 33 ++++++++++--------- Extension/View/SessionPunchClockView.tsx | 42 ++++++++++++++++++++++-- package.json | 2 +- 5 files changed, 74 insertions(+), 28 deletions(-) diff --git a/Extension/App/Popup.tsx b/Extension/App/Popup.tsx index 0132ba2..bf11882 100644 --- a/Extension/App/Popup.tsx +++ b/Extension/App/Popup.tsx @@ -13,29 +13,36 @@ import SessionPunchClockView from '../View/SessionPunchClockView' // Browser extension popup widget. const Popup = () => { console.log('>Popup') + // Example: // Live Coding AStartupMCC #39.F Add: Can clock and off to dummy... - const [ConfigSync, ConfigSyncSet] = useState(ModelConfigSyncInit) - const [ConfigLocal, ConfigLocalSet] = useState(ModelConfigLocalInit) + const [ConfigSync, ConfigSyncSet] = + useState(ModelConfigSyncInit) + const [ConfigLocal, ConfigLocalSet] = + useState(ModelConfigLocalInit) const [Syndicate, SyndicateSet ] = useState({}) - const [IsSaving, IsSavingSet] = useState(false) + useEffect(() => { console.log('[useEffect]') ModelConfigSyncGet().then(state => ConfigSyncSet(state)) ModelConfigLocalGet().then(state => ConfigLocalSet(state)) ModelSyndicateGet().then(state => SyndicateSet(state)) }, []) - if (ConfigSync == null) return
Config == null
+ if (ConfigLocal == null || ConfigSync == null) return
null
+ let { account, mission_ids, repo, session, session_ids } = ConfigSync if (session == undefined) return
Config members undefined
return

Account: {account} #{Math.abs(session)}

Repo: {repo}

-

Mission: #{mission_ids}

+

Mission: {mission_ids}

Heading: {session_ids}


-
} diff --git a/Extension/Model/index.ts b/Extension/Model/index.ts index 6f0136b..042bb65 100644 --- a/Extension/Model/index.ts +++ b/Extension/Model/index.ts @@ -19,10 +19,11 @@ export type ModelConfigSync = { // Local model configuration settings. export type ModelConfigLocal = { + account?: string //< Selected account. + mission_ids?: string //< Selected mission. modal_state: number //< State of the modal. // Options modal_visible: boolean //< Modal is visible flag. - mission: number //< Selected mission number. repo?: string //< Selected repo. session?: number //< Selected session number. } @@ -119,9 +120,10 @@ export const ModelConfigSyncInit: ModelConfigSync = { } export const ModelConfigLocalInit: ModelConfigLocal = { + account: '', + mission_ids: '', modal_visible: false, modal_state: 0, - mission: 0, repo: '', session: 0, } diff --git a/Extension/View/MissionSelector.tsx b/Extension/View/MissionSelector.tsx index 3b3ddc3..7a39790 100644 --- a/Extension/View/MissionSelector.tsx +++ b/Extension/View/MissionSelector.tsx @@ -1,7 +1,7 @@ // Copyright AStartup; license at https://github.com/AStarStartup/AStartupMCC import React from 'react' -import { RepoGitHub, ModelConfigSync, ModelConfigSyncSet +import { ModelConfigSync, ModelConfigLocal, ModelConfigLocalSet } from '../Model' const { LLIDNextHex } = require('linearid') @@ -69,24 +69,24 @@ export function IssueIsSelected(issue_num_title: string, mission_number_string: } export default function MissionSelector(props: { - ConfigSync : ModelConfigSync - ConfigSyncSet: (o: ModelConfigSync) => void + ConfigLocal : ModelConfigLocal + ConfigLocalSet: (o: ModelConfigLocal) => void + ModelConfigSyncSet : (config: ModelConfigSync) => Promise Syndicate: object }) { - - const { ConfigSync, ConfigSyncSet, Syndicate } = props - let { account, mission_ids, repo } = ConfigSync + const { ConfigLocal, ConfigLocalSet, Syndicate } = props + let { account, mission_ids, repo } = ConfigLocal console.log('MissionSelector: account:"' + account + '" repo:"' + repo + '" mission:"' + mission_ids + '"') console.log('Config:') - console.log(ConfigSync) + console.log(ConfigLocal) console.log("Syndicate:") console.log(Syndicate) console.log("repo:") console.log(repo) if(account == undefined || repo == undefined || mission_ids == undefined) - return
Config == null
+ return
undefined
let [repos, issues] = ListReposAndIssues(Syndicate, account, repo) @@ -96,7 +96,7 @@ export default function MissionSelector(props: { { console.log("Changing Repo:" + e.target.value) - const ConfigNew = {...ConfigSync, account: ConfigSync.account, repo: e.target.value} - ModelConfigSyncSet(ConfigNew).then(() => { - ConfigSyncSet(ConfigNew) + const ConfigNew = {...ConfigLocal, account: ConfigLocal.account, + repo: e.target.value} + ModelConfigLocalSet(ConfigNew).then(() => { + ConfigLocalSet(ConfigNew) }) }} value={repo}> { repos.map((key) => ( @@ -128,10 +129,10 @@ export default function MissionSelector(props: {