Loading frontend/src/analyst/dataHooks/useTools.ts +2 −2 Original line number Original line Diff line number Diff line import ExerciseContext from '@/analyst/ExerciseContext' import ExerciseContext from '@/analyst/ExerciseContext' import { useTypedQuery } from '@inject/graphql/graphql' import { useTypedQuery } from '@inject/graphql/graphql' import { GetTools } from '@inject/graphql/queries' import { GetExerciseTools } from '@inject/graphql/queries' import notEmpty from '@inject/shared/utils/notEmpty' import notEmpty from '@inject/shared/utils/notEmpty' import { useContext, useMemo } from 'react' import { useContext, useMemo } from 'react' Loading @@ -8,7 +8,7 @@ const useTools = () => { const { exercise } = useContext(ExerciseContext) const { exercise } = useContext(ExerciseContext) const [{ data: toolsData }] = useTypedQuery({ const [{ data: toolsData }] = useTypedQuery({ query: GetTools, query: GetExerciseTools, variables: { variables: { exerciseId: exercise.id, exerciseId: exercise.id, }, }, Loading frontend/src/components/Toolbar/index.tsx +4 −6 Original line number Original line Diff line number Diff line Loading @@ -4,7 +4,7 @@ import Sidebar from '@/components/Sidebar' import { css } from '@emotion/css' import { css } from '@emotion/css' import type { Tool } from '@inject/graphql/fragment-types' import type { Tool } from '@inject/graphql/fragment-types' import { useTypedQuery } from '@inject/graphql/graphql' import { useTypedQuery } from '@inject/graphql/graphql' import { GetTools } from '@inject/graphql/queries' import { GetTeamTools } from '@inject/graphql/queries' import notEmpty from '@inject/shared/utils/notEmpty' import notEmpty from '@inject/shared/utils/notEmpty' import type { FC } from 'react' import type { FC } from 'react' import { memo, useMemo } from 'react' import { memo, useMemo } from 'react' Loading @@ -17,7 +17,6 @@ const UNDEFINED_ID = 'undefined' interface ToolbarProps { interface ToolbarProps { teamId: string teamId: string exerciseId: string disabled?: boolean disabled?: boolean disabledTitle?: string disabledTitle?: string onClose?: () => void onClose?: () => void Loading @@ -25,19 +24,18 @@ interface ToolbarProps { const Toolbar: FC<ToolbarProps> = ({ const Toolbar: FC<ToolbarProps> = ({ teamId, teamId, exerciseId, disabled, disabled, disabledTitle, disabledTitle, onClose, onClose, }) => { }) => { const [{ data }] = useTypedQuery({ const [{ data }] = useTypedQuery({ query: GetTools, query: GetTeamTools, variables: { variables: { exerciseId, teamId, }, }, requestPolicy: 'cache-first', requestPolicy: 'cache-first', }) }) const process = (data?.exerciseTools ?? []).filter(notEmpty) const process = (data?.teamTools ?? []).filter(notEmpty) const groups: Map<string | undefined, Tool[]> = useMemo(() => { const groups: Map<string | undefined, Tool[]> = useMemo(() => { const uncategorized: Tool[] = [] const uncategorized: Tool[] = [] Loading frontend/src/pages/instructor/[exerciseId]/[teamId]/[channelId]/tool/_layout.tsx +1 −2 Original line number Original line Diff line number Diff line Loading @@ -6,7 +6,7 @@ import { createPortal } from 'react-dom' import { Outlet } from 'react-router-dom' import { Outlet } from 'react-router-dom' const ToolbarPortal = () => { const ToolbarPortal = () => { const { exerciseId, teamId } = useParams('/instructor/:exerciseId/:teamId') const { teamId } = useParams('/instructor/:exerciseId/:teamId') const [open, setOpen] = useState(false) const [open, setOpen] = useState(false) const portalRef = document.getElementById('toolPanel') const portalRef = document.getElementById('toolPanel') Loading @@ -17,7 +17,6 @@ const ToolbarPortal = () => { open && open && createPortal( createPortal( <Toolbar <Toolbar exerciseId={exerciseId} teamId={teamId} teamId={teamId} disabled disabled disabledTitle='Using tools is not allowed in instructor view' disabledTitle='Using tools is not allowed in instructor view' Loading frontend/src/pages/instructor/[exerciseId]/_layout.tsx +2 −1 Original line number Original line Diff line number Diff line Loading @@ -3,10 +3,11 @@ import useActionLogSubscriptionInstructor from '@inject/graphql/utils/Subscripti import { Outlet } from 'react-router-dom' import { Outlet } from 'react-router-dom' const LayoutExercise = () => { const LayoutExercise = () => { const { exerciseId } = useParams('/instructor/:exerciseId') const { exerciseId, teamId } = useParams('/instructor/:exerciseId/:teamId') useActionLogSubscriptionInstructor({ useActionLogSubscriptionInstructor({ exerciseId, exerciseId, teamId, }) }) return <Outlet /> return <Outlet /> Loading frontend/src/pages/trainee/[exerciseId]/[teamId]/[channelId]/tool/_layout.tsx +2 −6 Original line number Original line Diff line number Diff line Loading @@ -4,18 +4,14 @@ import { createPortal } from 'react-dom' import { Outlet } from 'react-router-dom' import { Outlet } from 'react-router-dom' const Layout = () => { const Layout = () => { const { exerciseId, teamId } = useParams('/trainee/:exerciseId/:teamId') const { teamId } = useParams('/trainee/:exerciseId/:teamId') const portalRef = document.getElementById('toolPanel') const portalRef = document.getElementById('toolPanel') return ( return ( <> <> <Outlet /> <Outlet /> {portalRef && {portalRef && createPortal(<Toolbar teamId={teamId} />, portalRef)} createPortal( <Toolbar teamId={teamId} exerciseId={exerciseId} />, portalRef )} </> </> ) ) } } Loading Loading
frontend/src/analyst/dataHooks/useTools.ts +2 −2 Original line number Original line Diff line number Diff line import ExerciseContext from '@/analyst/ExerciseContext' import ExerciseContext from '@/analyst/ExerciseContext' import { useTypedQuery } from '@inject/graphql/graphql' import { useTypedQuery } from '@inject/graphql/graphql' import { GetTools } from '@inject/graphql/queries' import { GetExerciseTools } from '@inject/graphql/queries' import notEmpty from '@inject/shared/utils/notEmpty' import notEmpty from '@inject/shared/utils/notEmpty' import { useContext, useMemo } from 'react' import { useContext, useMemo } from 'react' Loading @@ -8,7 +8,7 @@ const useTools = () => { const { exercise } = useContext(ExerciseContext) const { exercise } = useContext(ExerciseContext) const [{ data: toolsData }] = useTypedQuery({ const [{ data: toolsData }] = useTypedQuery({ query: GetTools, query: GetExerciseTools, variables: { variables: { exerciseId: exercise.id, exerciseId: exercise.id, }, }, Loading
frontend/src/components/Toolbar/index.tsx +4 −6 Original line number Original line Diff line number Diff line Loading @@ -4,7 +4,7 @@ import Sidebar from '@/components/Sidebar' import { css } from '@emotion/css' import { css } from '@emotion/css' import type { Tool } from '@inject/graphql/fragment-types' import type { Tool } from '@inject/graphql/fragment-types' import { useTypedQuery } from '@inject/graphql/graphql' import { useTypedQuery } from '@inject/graphql/graphql' import { GetTools } from '@inject/graphql/queries' import { GetTeamTools } from '@inject/graphql/queries' import notEmpty from '@inject/shared/utils/notEmpty' import notEmpty from '@inject/shared/utils/notEmpty' import type { FC } from 'react' import type { FC } from 'react' import { memo, useMemo } from 'react' import { memo, useMemo } from 'react' Loading @@ -17,7 +17,6 @@ const UNDEFINED_ID = 'undefined' interface ToolbarProps { interface ToolbarProps { teamId: string teamId: string exerciseId: string disabled?: boolean disabled?: boolean disabledTitle?: string disabledTitle?: string onClose?: () => void onClose?: () => void Loading @@ -25,19 +24,18 @@ interface ToolbarProps { const Toolbar: FC<ToolbarProps> = ({ const Toolbar: FC<ToolbarProps> = ({ teamId, teamId, exerciseId, disabled, disabled, disabledTitle, disabledTitle, onClose, onClose, }) => { }) => { const [{ data }] = useTypedQuery({ const [{ data }] = useTypedQuery({ query: GetTools, query: GetTeamTools, variables: { variables: { exerciseId, teamId, }, }, requestPolicy: 'cache-first', requestPolicy: 'cache-first', }) }) const process = (data?.exerciseTools ?? []).filter(notEmpty) const process = (data?.teamTools ?? []).filter(notEmpty) const groups: Map<string | undefined, Tool[]> = useMemo(() => { const groups: Map<string | undefined, Tool[]> = useMemo(() => { const uncategorized: Tool[] = [] const uncategorized: Tool[] = [] Loading
frontend/src/pages/instructor/[exerciseId]/[teamId]/[channelId]/tool/_layout.tsx +1 −2 Original line number Original line Diff line number Diff line Loading @@ -6,7 +6,7 @@ import { createPortal } from 'react-dom' import { Outlet } from 'react-router-dom' import { Outlet } from 'react-router-dom' const ToolbarPortal = () => { const ToolbarPortal = () => { const { exerciseId, teamId } = useParams('/instructor/:exerciseId/:teamId') const { teamId } = useParams('/instructor/:exerciseId/:teamId') const [open, setOpen] = useState(false) const [open, setOpen] = useState(false) const portalRef = document.getElementById('toolPanel') const portalRef = document.getElementById('toolPanel') Loading @@ -17,7 +17,6 @@ const ToolbarPortal = () => { open && open && createPortal( createPortal( <Toolbar <Toolbar exerciseId={exerciseId} teamId={teamId} teamId={teamId} disabled disabled disabledTitle='Using tools is not allowed in instructor view' disabledTitle='Using tools is not allowed in instructor view' Loading
frontend/src/pages/instructor/[exerciseId]/_layout.tsx +2 −1 Original line number Original line Diff line number Diff line Loading @@ -3,10 +3,11 @@ import useActionLogSubscriptionInstructor from '@inject/graphql/utils/Subscripti import { Outlet } from 'react-router-dom' import { Outlet } from 'react-router-dom' const LayoutExercise = () => { const LayoutExercise = () => { const { exerciseId } = useParams('/instructor/:exerciseId') const { exerciseId, teamId } = useParams('/instructor/:exerciseId/:teamId') useActionLogSubscriptionInstructor({ useActionLogSubscriptionInstructor({ exerciseId, exerciseId, teamId, }) }) return <Outlet /> return <Outlet /> Loading
frontend/src/pages/trainee/[exerciseId]/[teamId]/[channelId]/tool/_layout.tsx +2 −6 Original line number Original line Diff line number Diff line Loading @@ -4,18 +4,14 @@ import { createPortal } from 'react-dom' import { Outlet } from 'react-router-dom' import { Outlet } from 'react-router-dom' const Layout = () => { const Layout = () => { const { exerciseId, teamId } = useParams('/trainee/:exerciseId/:teamId') const { teamId } = useParams('/trainee/:exerciseId/:teamId') const portalRef = document.getElementById('toolPanel') const portalRef = document.getElementById('toolPanel') return ( return ( <> <> <Outlet /> <Outlet /> {portalRef && {portalRef && createPortal(<Toolbar teamId={teamId} />, portalRef)} createPortal( <Toolbar teamId={teamId} exerciseId={exerciseId} />, portalRef )} </> </> ) ) } } Loading