Skip to content

Commit 7dd0d15

Browse files
committed
test and slightly tweak free project shutdown
- there is a useInterval hook, so don't reinvent it. - red on grey is not optimal from an *accessibility* perspective, so switch the colorscheme to one of the officially supported ones for tags - reduced trial period a bit
1 parent 359027b commit 7dd0d15

File tree

3 files changed

+38
-67
lines changed

3 files changed

+38
-67
lines changed

src/packages/frontend/project/trial-banner.tsx

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
44
*/
55

6-
import { Alert, Modal, Space, Tag } from "antd";
6+
import { Alert, Modal, Space, Tag, Tooltip } from "antd";
77
import humanizeList from "humanize-list";
88
import { join } from "path";
9-
9+
import { useInterval } from "react-interval-hook";
1010
import {
1111
CSS,
1212
React,
1313
redux,
14-
useEffect,
1514
useForceUpdate,
1615
useMemo,
1716
useRef,
@@ -387,11 +386,7 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
387386
const openFiles = useTypedRedux({ project_id }, "open_files_order");
388387
const triggered = useRef<boolean>(false);
389388
const update = useForceUpdate();
390-
391-
useEffect(() => {
392-
const interval = setInterval(update, 1000);
393-
return () => clearInterval(interval);
394-
}, []);
389+
useInterval(update, 1000);
395390

396391
if (
397392
status.get("state") !== "running" ||
@@ -404,7 +399,9 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
404399

405400
// start_ts is e.g. 1508576664416
406401
const start_ts = project.getIn(["status", "start_ts"]);
407-
if (start_ts == undefined) return null;
402+
if (start_ts == null && !showInfo) {
403+
return null;
404+
}
408405

409406
const shutdown_ts = start_ts + 1000 * 60 * limit_min;
410407
const countdown = shutdown_ts - server_time().getTime();
@@ -449,7 +446,7 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
449446
<A href={BUY_A_LICENSE_URL}>purchasing a license</A>.
450447
</Paragraph>
451448
<Paragraph>
452-
Behind this curtains,{" "}
449+
Behind the curtain,{" "}
453450
<A href={"/about/team"}>humans are working hard</A> to keep the
454451
service running and improving it constantly. Your files and
455452
computations <A href={"/info/status"}>run in our cluster</A>,
@@ -470,7 +467,8 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
470467
>
471468
Contact us
472469
</A>{" "}
473-
if you can give support in other ways.
470+
if you can give support in other ways or have any questions or
471+
comments.
474472
</Paragraph>
475473
</>
476474
}
@@ -482,30 +480,31 @@ function CountdownProject({ fontSize }: CountdownProjectProps) {
482480
return (
483481
<>
484482
{renderInfo()}
485-
<Tag
486-
style={{
487-
marginTop: "5px",
488-
fontSize,
489-
float: "right",
490-
fontWeight: "bold",
491-
color: COLORS.ANTD_RED,
492-
cursor: "pointer",
493-
}}
494-
color={COLORS.GRAY_LL}
495-
onClick={() => {
496-
setShowInfo(true);
497-
track("trial-banner", { what: "countdown", project_id });
498-
}}
499-
>
500-
<TimeAmount
501-
key={"time"}
502-
amount={countdwon0}
503-
compact={true}
504-
showIcon={true}
505-
countdown={countdwon0}
506-
style={{ color: COLORS.ANTD_RED }}
507-
/>
508-
</Tag>
483+
<Tooltip title="Automatic Project Shutdown: click for details...">
484+
<Tag
485+
style={{
486+
marginTop: "5px",
487+
fontSize,
488+
float: "right",
489+
fontWeight: "bold",
490+
cursor: "pointer",
491+
}}
492+
color={"red"}
493+
onClick={() => {
494+
setShowInfo(true);
495+
track("trial-banner", { what: "countdown", project_id });
496+
}}
497+
>
498+
<TimeAmount
499+
key={"time"}
500+
amount={countdwon0}
501+
compact={true}
502+
showIcon={true}
503+
countdown={countdwon0}
504+
style={{ color: COLORS.ANTD_RED }}
505+
/>
506+
</Tag>
507+
</Tooltip>
509508
</>
510509
);
511510
}

src/packages/next/pages/pricing/onprem.tsx

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,8 @@ function Body() {
145145
<Title level={3}>Purchasing CoCalc OnPrem</Title>
146146
<Paragraph>
147147
CoCalc OnPrem is a scalable solution and the license price depends on
148-
the use case and expected number of users. Additionally, various
149-
levels of support and custom development can be negotiated for an
150-
additional cost.
148+
the use case, expected number of users, level of support, and amount
149+
of customization and training involved.
151150
<Button
152151
type="link"
153152
onClick={() =>
@@ -159,33 +158,6 @@ function Body() {
159158
Contact us for a quote.
160159
</Button>
161160
</Paragraph>
162-
<Paragraph>
163-
The price starts at{" "}
164-
<Button
165-
type="primary"
166-
size="large"
167-
onClick={() =>
168-
router.push(
169-
`/support/new?hideExtra=true&type=purchase&subject=CoCalc%20OnPrem%20Business&body=${body}&title=Purchase%20CoCalc-OnPrem`,
170-
)
171-
}
172-
>
173-
{K8S_PRICE}/year
174-
</Button>{" "}
175-
or, if an academic discount applies, starting at{" "}
176-
<Button
177-
type="primary"
178-
size="large"
179-
onClick={() =>
180-
router.push(
181-
`/support/new?hideExtra=true&type=purchase&subject=CoCalc%20OnPrem%20Academic&body=${body}&title=Purchase%20CoCalc-OnPrem`,
182-
)
183-
}
184-
>
185-
{K8S_PRICE_ACADEMIC}/year
186-
</Button>
187-
.
188-
</Paragraph>
189161
</>
190162
);
191163
}

src/packages/util/consts/billing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ export const ONE_MONTH_MS = AVG_MONTH_DAYS * ONE_DAY_MS;
1313
export const LICENSE_MIN_PRICE = "about $5/month";
1414

1515
// Trial Banner in the UI
16-
export const EVALUATION_PERIOD_DAYS = 10;
17-
export const BANNER_NON_DISMISSABLE_DAYS = 15;
16+
export const EVALUATION_PERIOD_DAYS = 3;
17+
export const BANNER_NON_DISMISSABLE_DAYS = 7;

0 commit comments

Comments
 (0)