Skip to content

Commit e093242

Browse files
authored
Add cube download (#31)
* Add cube download button to settings * Move button to side panel and adjust css * Lint
1 parent e95ee59 commit e093242

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

src/widgets/LeftSidebar.tsx

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { faSpinner } from '@fortawesome/free-solid-svg-icons';
1+
import { faDownload, faSpinner } from '@fortawesome/free-solid-svg-icons';
22
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
33
import { ReactWidget } from '@jupyterlab/apputils';
44
import { Button, SidePanel, UseSignal } from '@jupyterlab/ui-components';
@@ -75,6 +75,12 @@ const LeftSidebarComponent = ({ modelList, modelRegistry }: IModelInfoList) => {
7575
handleCloseAddModelModal();
7676
};
7777

78+
const handleDownload = () => {
79+
const url =
80+
'https://raw.githubusercontent.com/QuantStack/jupyterlab-gather/main/resources/ar-cubes/cube1.pdf';
81+
window.open(url, '_blank', 'noopener,noreferrer');
82+
};
83+
7884
return (
7985
<div className="jlab-gather-sidebar-container">
8086
<div className="jlab-gather-sidebar-description">
@@ -97,21 +103,15 @@ const LeftSidebarComponent = ({ modelList, modelRegistry }: IModelInfoList) => {
97103
</div>
98104
<div style={{ display: 'flex', flexDirection: 'column' }}>
99105
<div className="jlab-gather-sidebar-buttons">
100-
<Button
101-
className="jlab-gather-sidebar-button"
102-
onClick={() => handleModelSelectClick(0)}
103-
>
106+
<Button onClick={() => handleModelSelectClick(0)}>
104107
Set as first model
105108
</Button>
106-
<Button
107-
className="jlab-gather-sidebar-button"
108-
onClick={() => handleModelSelectClick(1)}
109-
>
109+
<Button onClick={() => handleModelSelectClick(1)}>
110110
Set as second model
111111
</Button>
112112
</div>
113113
<Button
114-
className="jlab-gather-sidebar-load-button"
114+
className="jlab-gather-sidebar-button"
115115
onClick={handleOpenAddUrlModal}
116116
disabled={isDisabled}
117117
>
@@ -123,7 +123,7 @@ const LeftSidebarComponent = ({ modelList, modelRegistry }: IModelInfoList) => {
123123
onClose={handleCloseAddModelModal}
124124
/>
125125
<Button
126-
className="jlab-gather-sidebar-load-button"
126+
className="jlab-gather-sidebar-button"
127127
onClick={handleOpenAddFileModal}
128128
disabled={isDisabled}
129129
>
@@ -135,7 +135,7 @@ const LeftSidebarComponent = ({ modelList, modelRegistry }: IModelInfoList) => {
135135
onClose={handleCloseAddModelModal}
136136
/>
137137
<Button
138-
className="jlab-gather-sidebar-load-button"
138+
className="jlab-gather-sidebar-button"
139139
onClick={handleLoadSecondScene}
140140
disabled={isDisabled}
141141
>
@@ -147,6 +147,16 @@ const LeftSidebarComponent = ({ modelList, modelRegistry }: IModelInfoList) => {
147147
'Load Second Model'
148148
)}
149149
</Button>
150+
<Button
151+
className="jlab-gather-sidebar-button jlab-gather-btn-with-icon"
152+
onClick={handleDownload}
153+
>
154+
<FontAwesomeIcon
155+
icon={faDownload}
156+
className="jlab-gather-icon-small"
157+
/>
158+
Download AR Cube
159+
</Button>
150160
</div>
151161
</div>
152162
);

style/base.css

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
border: 2px solid transparent;
2323
border-radius: var(--gather-border-radius);
2424
font-family: inherit;
25-
color: var(--jp-ui-font-color0);
25+
color: var(--jp-ui-font-color1);
2626
}
2727

2828
.jlab-gather-input::placeholder {
@@ -56,6 +56,12 @@
5656
color: whitesmoke;
5757
}
5858

59+
.jlab-gather-btn-with-icon {
60+
display: flex;
61+
align-items: center;
62+
gap: 0.5rem;
63+
}
64+
5965
.jlab-gather-btn-danger {
6066
background-color: var(--jp-warn-color1) !important;
6167
color: black !important;
@@ -268,14 +274,9 @@
268274
}
269275

270276
.jlab-gather-sidebar-button {
271-
color: var(--jp-inverse-layout-color4);
272-
}
273-
274-
.jlab-gather-sidebar-load-button {
275277
max-width: 313px;
276278
margin: 0.5rem;
277279
padding: 0.5rem;
278-
color: var(--jp-inverse-layout-color4);
279280
}
280281

281282
.jlab-gather-presenter-container {
@@ -374,10 +375,6 @@
374375
color: var(--jp-ui-inverse-font-color1);
375376
}
376377

377-
.jlab-gather-avatar-grid {
378-
/* height: 60%; */
379-
}
380-
381378
.jlab-gather-avatar-sidepane {
382379
width: 128px;
383380
height: 128px;
@@ -447,6 +444,7 @@
447444

448445
.jlab-gather-device-settings-row {
449446
display: flex;
447+
align-items: center;
450448
}
451449

452450
.jlab-gather-device-title {

0 commit comments

Comments
 (0)