-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Popup: Upgrade dummy session logger buttons to component #102.A
- Loading branch information
1 parent
80dd430
commit 195e1da
Showing
8 changed files
with
316 additions
and
236 deletions.
There are no files selected for viewing
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
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,35 @@ | ||
// Copyright AStartup; license at https://github.com/AStarStartup/AStartupMCC | ||
|
||
'use client' | ||
|
||
import { AIssueTicket } from '../../Lib/Model' | ||
import { DataAccess } from '../../Lib/Model/IDB' | ||
import { ModelIssueSet } from '../Model' | ||
|
||
export default function UseModelState(account: string, repo: string) { | ||
let db_name: string = account + '/' + repo | ||
let store_name: string = 'Issues' | ||
const idb = new DataAccess<AIssueTicket>(db_name, store_name); | ||
|
||
function ModelStateReducer(state, action: object) { | ||
switch (action['verb']) { | ||
case 'SelectIssue': { | ||
const UID = action['uid'] | ||
if(UID == undefined) return | ||
const Issue = idb.Get(UID) | ||
ModelIssueSet({ ...state, issue: Issue }) | ||
return state | ||
} | ||
case 'SelectMission': { | ||
const UID = action['uid'] | ||
if(UID == undefined) return | ||
const Issue = idb.Get(UID) | ||
ModelIssueSet({ ...state, mission: Issue }) | ||
return state | ||
} | ||
default: return state | ||
} | ||
} | ||
|
||
return [ idb, ModelStateReducer ] | ||
} |
Oops, something went wrong.