Bugs fixed: - 'cc-teacher-timetable-node' missing from NODE_TYPE_THEMES caused Cannot read properties of undefined (reading 'headerColor') crash when clicking My Timetable - 'cc-journal-node' and 'cc-planner-node' had no shape utils registered, causing 'No shape util found for type' error on Journal/Planner click - Added null safety (?? fallback) to getNodeTheme to prevent future crashes from any other unmapped type - Removed AcademicWeek from canExpand exclusion so weeks can be expanded to show individual academic days Added: - CCJournalNodeShapeUtil and CCPlannerNodeShapeUtil (stub shapes) - CCJournalNodeProps and CCPlannerNodeProps types - Journal/Planner added to CCNodeTypes, ccGraphShapeProps, NODE_TYPE_THEMES - 'cc-department-structure-node' mapping added to NODE_TYPE_THEMES Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { CCBaseShapeUtil } from '../CCBaseShapeUtil'
|
|
import { CCBaseShape } from '../cc-types'
|
|
import { ccGraphShapeProps, getDefaultCCPlannerNodeProps } from './cc-graph-props'
|
|
import { getNodeStyles, NODE_THEMES, NODE_TYPE_THEMES } from './cc-graph-styles'
|
|
import { CCPlannerNodeProps } from './cc-graph-types'
|
|
|
|
export interface CCPlannerNodeShape extends CCBaseShape {
|
|
type: 'cc-planner-node'
|
|
props: CCPlannerNodeProps
|
|
}
|
|
|
|
export class CCPlannerNodeShapeUtil extends CCBaseShapeUtil<CCPlannerNodeShape> {
|
|
static type = 'cc-planner-node' as const
|
|
static props = ccGraphShapeProps['cc-planner-node']
|
|
|
|
getDefaultProps(): CCPlannerNodeShape['props'] {
|
|
const defaultProps = getDefaultCCPlannerNodeProps()
|
|
const theme = NODE_THEMES[NODE_TYPE_THEMES[CCPlannerNodeShapeUtil.type]] ?? NODE_THEMES.resource
|
|
return {
|
|
...defaultProps,
|
|
headerColor: theme.headerColor,
|
|
}
|
|
}
|
|
|
|
DefaultComponent = () => null
|
|
|
|
renderContent = (shape: CCPlannerNodeShape) => {
|
|
const styles = getNodeStyles(shape.type)
|
|
return (
|
|
<div style={styles.container}>
|
|
<div style={{ ...styles.header, color: shape.props.headerColor }}>Planner</div>
|
|
<div style={{ fontSize: 11, color: 'var(--color-text-2)' }}>Lesson and weekly planner</div>
|
|
</div>
|
|
)
|
|
}
|
|
}
|