@capytale/meta-player 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capytale/meta-player",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -24,7 +24,6 @@
24
24
  "react-dom": "^18.2.0",
25
25
  "react-html-props": "^2.0.9",
26
26
  "react-redux": "^9.1.0",
27
- "react-reverse-portal": "^2.1.2",
28
27
  "screenfull": "^6.0.2"
29
28
  },
30
29
  "devDependencies": {
package/src/App.tsx CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  selectOrientation,
14
14
  toggleIsPedagoVisible,
15
15
  } from "./features/layout/layoutSlice";
16
- import { FC, PropsWithChildren, useMemo } from "react";
16
+ import { FC, PropsWithChildren } from "react";
17
17
  import { Tooltip } from "primereact/tooltip";
18
18
  import {
19
19
  selectHasGradingOrComments,
@@ -23,8 +23,6 @@ import {
23
23
  import settings from "./settings";
24
24
  import ReviewNavbar from "./features/navbar/ReviewNavbar";
25
25
 
26
- import * as portals from "react-reverse-portal";
27
-
28
26
  type AppProps = PropsWithChildren<{}>;
29
27
 
30
28
  const App: FC<AppProps> = (props) => {
@@ -36,8 +34,7 @@ const App: FC<AppProps> = (props) => {
36
34
  const hasGradingOrComments = useAppSelector(selectHasGradingOrComments);
37
35
  const hasPedago = hasInstructions || hasGradingOrComments;
38
36
  const dispatch = useAppDispatch();
39
-
40
- const portalNode = useMemo(() => portals.createHtmlPortalNode(), []);
37
+ const showPedago = hasPedago && isPedagoVisible;
41
38
 
42
39
  return (
43
40
  <div
@@ -47,78 +44,72 @@ const App: FC<AppProps> = (props) => {
47
44
  isHorizontal ? "layout-horizontal" : "layout-vertical",
48
45
  )}
49
46
  >
50
- <portals.InPortal node={portalNode}>
51
- <div id="meta-player-content">{props.children}</div>
52
- </portals.InPortal>
53
47
  <div>
54
48
  <Navbar />
55
49
  {mode === "review" && <ReviewNavbar />}
56
50
  </div>
57
- {hasPedago && isPedagoVisible && (
58
- <Splitter
59
- className={styles.appPedagoSplitter}
60
- layout={isHorizontal ? "vertical" : "horizontal"}
51
+ <div className={styles.pedagoContainer} data-show-pedago={showPedago}>
52
+ <div
53
+ className={classNames(
54
+ styles.hiddenPedago,
55
+ hasPedago ? null : styles.noPedago,
56
+ )}
61
57
  >
62
- <SplitterPanel minSize={15} size={30} className={styles.pedagoPanel}>
63
- <Pedago key="pedago" />
64
- </SplitterPanel>
65
- <SplitterPanel minSize={40} size={70}>
66
- <portals.OutPortal node={portalNode} />
67
- </SplitterPanel>
68
- </Splitter>
69
- )}
70
- {(!hasPedago || !isPedagoVisible) && (
71
- <div className={styles.hiddenPedagoContainer}>
72
58
  <div
73
59
  className={classNames(
74
- styles.hiddenPedago,
75
- hasPedago ? null : styles.noPedago,
60
+ styles.hiddenPedagoButton,
61
+ hasPedago ? "p-ripple" : null,
76
62
  )}
63
+ onClick={
64
+ hasPedago ? () => dispatch(toggleIsPedagoVisible()) : undefined
65
+ }
66
+ data-pr-tooltip={
67
+ hasPedago
68
+ ? "Afficher les consignes"
69
+ : "Pas de consignes ni de note"
70
+ }
71
+ aria-label={
72
+ hasPedago
73
+ ? "Afficher les consignes"
74
+ : "Pas de consignes ni de note"
75
+ }
76
+ role={hasPedago ? "button" : "note"}
77
77
  >
78
- <div
78
+ <i
79
79
  className={classNames(
80
- styles.hiddenPedagoButton,
81
- hasPedago ? "p-ripple" : null,
82
- )}
83
- onClick={
84
- hasPedago ? () => dispatch(toggleIsPedagoVisible()) : undefined
85
- }
86
- data-pr-tooltip={
87
- hasPedago
88
- ? "Afficher les consignes"
89
- : "Pas de consignes ni de note"
90
- }
91
- aria-label={
80
+ "pi",
92
81
  hasPedago
93
- ? "Afficher les consignes"
94
- : "Pas de consignes ni de note"
95
- }
96
- role={hasPedago ? "button" : "note"}
97
- >
98
- <i
99
- className={classNames(
100
- "pi",
101
- hasPedago
102
- ? isHorizontal
103
- ? "pi-angle-double-down"
104
- : "pi-angle-double-right"
105
- : "pi-minus-circle",
106
- )}
107
- />
108
- <Ripple />
109
- </div>
110
- <Tooltip
111
- target={"." + styles.hiddenPedagoButton}
112
- showDelay={settings.TOOLTIP_SHOW_DELAY}
113
- position={isHorizontal ? "bottom" : "right"}
114
- mouseTrack={!isHorizontal}
82
+ ? isHorizontal
83
+ ? "pi-angle-double-down"
84
+ : "pi-angle-double-right"
85
+ : "pi-minus-circle",
86
+ )}
115
87
  />
88
+ <Ripple />
116
89
  </div>
117
- <div className={styles.hiddenPedagoContent}>
118
- <portals.OutPortal node={portalNode} />
119
- </div>
90
+ <Tooltip
91
+ target={"." + styles.hiddenPedagoButton}
92
+ showDelay={settings.TOOLTIP_SHOW_DELAY}
93
+ position={isHorizontal ? "bottom" : "right"}
94
+ mouseTrack={!isHorizontal}
95
+ />
120
96
  </div>
121
- )}
97
+ <Splitter
98
+ className={styles.appPedagoSplitter}
99
+ layout={isHorizontal ? "vertical" : "horizontal"}
100
+ >
101
+ <SplitterPanel
102
+ minSize={15}
103
+ size={30}
104
+ className={styles.pedagoPanel}
105
+ >
106
+ <Pedago key="pedago" />
107
+ </SplitterPanel>
108
+ <SplitterPanel minSize={40} size={70}>
109
+ <div id="meta-player-content">{props.children}</div>
110
+ </SplitterPanel>
111
+ </Splitter>
112
+ </div>
122
113
  </div>
123
114
  );
124
115
  };
@@ -9,6 +9,14 @@
9
9
  border: none;
10
10
  border-radius: 0;
11
11
  overflow-y: hidden;
12
+ .pedagoContainer[data-show-pedago="false"] & {
13
+ & > :first-child {
14
+ display: none;
15
+ }
16
+ & > :nth-child(2) {
17
+ display: none;
18
+ }
19
+ }
12
20
  }
13
21
 
14
22
  .pedagoPanel {
@@ -17,7 +25,7 @@
17
25
  overflow-y: hidden;
18
26
  }
19
27
 
20
- .hiddenPedagoContainer {
28
+ .pedagoContainer {
21
29
  display: grid;
22
30
  :global(.layout-horizontal) & {
23
31
  grid-template-columns: 1fr;
@@ -27,10 +35,16 @@
27
35
  grid-template-rows: 1fr;
28
36
  grid-template-columns: 1.2rem 1fr;
29
37
  }
38
+ &[data-show-pedago="true"] {
39
+ display: block;
40
+ }
30
41
  }
31
42
 
32
43
  .hiddenPedago {
33
44
  background-color: var(--surface-200);
45
+ .pedagoContainer[data-show-pedago="true"] & {
46
+ display: none;
47
+ }
34
48
  }
35
49
 
36
50
  .hiddenPedagoButton {
@@ -50,7 +64,3 @@
50
64
  background-color: rgba(128, 128, 128, 0.2);
51
65
  }
52
66
  }
53
-
54
- .hiddenPedagoContent {
55
- background-color: var(--surface-a);
56
- }
package/src/index.css CHANGED
@@ -36,4 +36,5 @@ body,
36
36
  #meta-player-content,
37
37
  :has(> #meta-player-content) {
38
38
  height: 100%;
39
+ background-color: var(--surface-a);
39
40
  }