Skip to content

Commit 61e0e29

Browse files
authored
Fix links and add user survey banner (#289)
* Link fixes * Add survey link
1 parent b3db5a8 commit 61e0e29

File tree

4 files changed

+70
-4
lines changed

4 files changed

+70
-4
lines changed

shared/settings.ts

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class Settings {
1818
autocompleteDisabled: boolean;
1919
theme: 'light' | 'dark';
2020
caCerts: Array<{ file: string; id: string }>;
21+
surveyAug2022: boolean;
2122

2223
constructor(
2324
file: string,
@@ -41,5 +42,7 @@ export class Settings {
4142
this.stdoutMaxSize = stdoutMaxSize || 5000;
4243
this.file = file;
4344
this.caCerts = [];
45+
46+
this.surveyAug2022 = true;
4447
}
4548
}

ui/app.tsx

+35
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
IconCalendar,
3+
IconCircleX,
34
IconCode,
45
IconFiles,
56
IconHelp,
@@ -11,6 +12,8 @@ import * as React from 'react';
1112
import { MODE, MODE_FEATURES } from '../shared/constants';
1213
import { LANGUAGES } from '../shared/languages';
1314
import '../shared/polyfill';
15+
import { Settings as SettingsT } from '../shared/settings';
16+
import { Button } from './components/Button';
1417
import { ErrorBoundary } from './components/ErrorBoundary';
1518
import { Loading } from './components/Loading';
1619
import { Editor } from './Editor';
@@ -102,6 +105,37 @@ export function defaultRoutes(): Routes {
102105
].filter(Boolean);
103106
}
104107

108+
function Aug2022Survey({
109+
settings,
110+
setSettings,
111+
}: {
112+
settings: SettingsT;
113+
setSettings: (s: Partial<SettingsT>) => void;
114+
}) {
115+
if (!settings.surveyAug2022) {
116+
return null;
117+
}
118+
119+
return (
120+
<div className="banner vertical-align-center">
121+
<Button
122+
icon
123+
onClick={() => setSettings({ ...settings, surveyAug2022: false })}
124+
>
125+
<IconCircleX />
126+
</Button>
127+
Help us out: take a quick
128+
<a
129+
target="_blank"
130+
href="https://docs.google.com/forms/d/e/1FAIpQLSdNhU5k3FsIkcea_CTPVrmJ45k0czRz60XqLmBVUE5TjaT_jg/viewform"
131+
>
132+
user survey
133+
</a>
134+
!
135+
</div>
136+
);
137+
}
138+
105139
export function App<T extends DefaultView = DefaultView>({
106140
routes,
107141
}: {
@@ -179,6 +213,7 @@ export function App<T extends DefaultView = DefaultView>({
179213
<SettingsContext.Provider
180214
value={{ state: settings, setState: setSettings }}
181215
>
216+
<Aug2022Survey settings={settings} setSettings={setSettings} />
182217
<div className={`app app--${MODE} app--${settings.theme}`}>
183218
{MODE_FEATURES.appHeader && !isMakeSelect && <Header />}
184219
<main className={'view view-' + (urlState.view || 'editor')}>

ui/components/Link.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface LinkProps {
77
children?: React.ReactNode;
88
}
99

10-
export function Link({ args, className }: LinkProps) {
10+
export function Link({ args, className, children }: LinkProps) {
1111
const url =
1212
'?' +
1313
Object.entries(args)
@@ -19,5 +19,9 @@ export function Link({ args, className }: LinkProps) {
1919
setUrlState(args);
2020
}
2121

22-
return <a href={url} onClick={navigate} className={className} />;
22+
return (
23+
<a href={url} onClick={navigate} className={className}>
24+
{children}
25+
</a>
26+
);
2327
}

ui/style.css

+26-2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,24 @@ li {
9494
height: calc(100% - 39px);
9595
}
9696

97+
.banner {
98+
padding: 3px 15px;
99+
color: white;
100+
background: black;
101+
font-size: 0.9rem;
102+
103+
a {
104+
color: white;
105+
padding-left: 3px;
106+
}
107+
108+
.button {
109+
background: transparent;
110+
margin-right: 10px;
111+
color: white;
112+
}
113+
}
114+
97115
.main-body {
98116
flex: 1;
99117
overflow-y: auto;
@@ -425,10 +443,16 @@ input + input[type='file'] {
425443
box-shadow: 0px 0px 3px var(--border-light);
426444
}
427445

428-
.button:hover {
446+
.button:not(.button--icon):hover {
429447
background: #f0f0f0;
430448
}
431449

450+
.button--icon:hover {
451+
svg {
452+
stroke-width: 3;
453+
}
454+
}
455+
432456
.button--primary {
433457
border-color: #3a005f;
434458
background: #9f04ff;
@@ -706,7 +730,7 @@ input + input[type='file'] {
706730
position: absolute;
707731
left: 0;
708732
top: 0;
709-
z-index: 999;
733+
z-index: 16;
710734
height: 100%;
711735
width: 100%;
712736
margin: 0;

0 commit comments

Comments
 (0)