position ui and owliver update
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { useMemo } from 'react';
|
||||
import { usePreferences } from '@/lib/krowHooks';
|
||||
import {
|
||||
isSkillOnPage, pageDefinitionForSkillId, skillStatesForPage, workforceSkillsForPage,
|
||||
isSkillOnPage, pageDefinitionForSkillId, skillStatesForPage, workforceSkillStates,
|
||||
workforceSkillsForPage,
|
||||
} from './pageSkills';
|
||||
|
||||
/**
|
||||
@@ -25,6 +26,33 @@ import {
|
||||
* already exists — a training prompt beside a position requirement, say — where
|
||||
* the page is not listing skills but is about to mention one.
|
||||
*/
|
||||
/**
|
||||
* Every training path, for the views that manage training rather than surface it.
|
||||
*
|
||||
* The same preferences plumbing as `usePageSkills`, asking `pageSkills.js` the
|
||||
* other question it answers — so Workspace & Skills and Skill Development count
|
||||
* paths from the registry rather than keeping a list of their own.
|
||||
*/
|
||||
export function useWorkforcePaths() {
|
||||
const preferences = usePreferences();
|
||||
|
||||
const customKey = JSON.stringify(preferences.customSkills || []);
|
||||
const disabledKey = JSON.stringify(preferences.disabledSkills || []);
|
||||
|
||||
return useMemo(() => {
|
||||
const options = {
|
||||
customSources: JSON.parse(customKey),
|
||||
disabled: JSON.parse(disabledKey),
|
||||
};
|
||||
return {
|
||||
/** The training paths themselves, before anyone's progress is applied. */
|
||||
paths: workforceSkillStates([], null, options).map((entry) => entry.definition),
|
||||
/** Each path paired with one person's state in it. */
|
||||
statesFor: (courses, profile) => workforceSkillStates(courses, profile, options),
|
||||
};
|
||||
}, [customKey, disabledKey]);
|
||||
}
|
||||
|
||||
export function usePageSkills(pageId) {
|
||||
const preferences = usePreferences();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user