Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(apps/frontend-manage): make activity evaluation pages resizable #4362

Merged
merged 16 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import ElementChart from '../ElementChart'
import { TextSizeType } from '../textSizes'
import ChoicesSidebar from './ChoicesSidebar'

import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from '@uzh-bf/design-system/dist/future'

interface ChoicesEvaluationProps {
instanceEvaluation: ChoicesElementInstanceEvaluation
textSize: TextSizeType
Expand All @@ -21,23 +27,35 @@ function ChoicesEvaluation({
type,
}: ChoicesEvaluationProps) {
return (
<>
<div className="order-2 flex-1 px-4 md:order-1">
<ResizablePanelGroup
autoSaveId="evaluation-choices"
key={`panel-group-${instanceEvaluation.id}`}
direction="horizontal"
>
rschlaefli marked this conversation as resolved.
Show resolved Hide resolved
<ResizablePanel defaultSize={80} minSize={50} className="px-4">
<ElementChart
chartType={chartType}
instanceEvaluation={instanceEvaluation}
showSolution={showSolution}
textSize={textSize}
/>
</div>

<ChoicesSidebar
instance={instanceEvaluation}
textSize={textSize}
showSolution={showSolution}
type={type}
/>
</>
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel
defaultSize={20}
minSize={10}
collapsible
collapsedSize={0}
className={twMerge('gap-2 border-l px-4 py-2', textSize.text)}
>
<ChoicesSidebar
instance={instanceEvaluation}
textSize={textSize}
showSolution={showSolution}
type={type}
/>
</ResizablePanel>
</ResizablePanelGroup>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import ElementChart from '../ElementChart'
import { TextSizeType } from '../textSizes'
import FTSidebar from './FTSidebar'

import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from '@uzh-bf/design-system/dist/future'
import { useState } from 'react'

interface FTEvaluationProps {
instanceEvaluation: FreeElementInstanceEvaluation
textSize: TextSizeType
Expand All @@ -20,23 +27,55 @@ function FTEvaluation({
showSolution,
type,
}: FTEvaluationProps) {
const [isCollapsed, setIsCollapsed] = useState(false)

return (
<>
<div className="order-2 flex-1 px-4 md:order-1">
<ElementChart
chartType={chartType}
instanceEvaluation={instanceEvaluation}
showSolution={showSolution}
textSize={textSize}
/>
</div>
{instanceEvaluation.results.solutions && showSolution && (
<FTSidebar
instance={instanceEvaluation}
textSize={textSize}
showSolution={showSolution}
type={type}
/>
{showSolution ? (
<ResizablePanelGroup
autoSaveId="evaluation-ft"
key={`panel-group-${instanceEvaluation.id}`}
direction="horizontal"
>
<ResizablePanel defaultSize={80} minSize={50} className="px-4">
<ElementChart
chartType={chartType}
instanceEvaluation={instanceEvaluation}
showSolution={showSolution}
textSize={textSize}
/>
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel
defaultSize={20}
minSize={10}
collapsible
collapsedSize={0}
onCollapse={() => setIsCollapsed(true)}
onExpand={() => setIsCollapsed(false)}
className={twMerge('gap-2 border-l px-4 py-2', textSize.text)}
>
{instanceEvaluation.results.solutions &&
showSolution &&
!isCollapsed && (
<FTSidebar
instance={instanceEvaluation}
textSize={textSize}
showSolution={showSolution}
type={type}
/>
)}
</ResizablePanel>
</ResizablePanelGroup>
) : (
<div className="order-2 flex-1 px-4 md:order-1">
<ElementChart
chartType={chartType}
instanceEvaluation={instanceEvaluation}
showSolution={showSolution}
textSize={textSize}
/>
</div>
)}
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import ElementChart from '../ElementChart'
import { TextSizeType } from '../textSizes'
import NRSidebar from './NRSidebar'

import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from '@uzh-bf/design-system/dist/future'

interface NREvaluationProps {
instanceEvaluation: NumericalElementInstanceEvaluation
textSize: TextSizeType
Expand All @@ -29,6 +35,7 @@ function NREvaluation({
showSolution,
type,
}: NREvaluationProps) {
const [isCollapsed, setIsCollapsed] = useState(false)
const [showStatistics, setShowStatistics] = useState<ShowStatisticsType>({
mean: false,
median: false,
Expand All @@ -38,26 +45,43 @@ function NREvaluation({
})

return (
<>
<div className="order-2 flex-1 px-4 md:order-1">
<ResizablePanelGroup
autoSaveId="evaluation-nr"
key={`panel-group-${instanceEvaluation.id}`}
direction="horizontal"
>
<ResizablePanel defaultSize={80} minSize={50} className="px-4">
<ElementChart
chartType={chartType}
instanceEvaluation={instanceEvaluation}
showSolution={showSolution}
showStatistics={showStatistics}
textSize={textSize}
/>
</div>
<NRSidebar
instance={instanceEvaluation}
chartType={chartType}
textSize={textSize}
showSolution={showSolution}
showStatistics={showStatistics}
setShowStatistics={setShowStatistics}
type={type}
/>
</>
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel
defaultSize={20}
minSize={10}
collapsible
collapsedSize={0}
onCollapse={() => setIsCollapsed(true)}
onExpand={() => setIsCollapsed(false)}
className={twMerge('gap-2 border-l px-4 py-2', textSize.text)}
rschlaefli marked this conversation as resolved.
Show resolved Hide resolved
>
{!isCollapsed && (
<NRSidebar
instance={instanceEvaluation}
chartType={chartType}
textSize={textSize}
showSolution={showSolution}
showStatistics={showStatistics}
setShowStatistics={setShowStatistics}
type={type}
/>
)}
</ResizablePanel>
</ResizablePanelGroup>
)
}

Expand Down
Loading