Skip to content

Commit ff8c669

Browse files
committed
much more aggressive "live demo" button(s)
1 parent afae9ba commit ff8c669

File tree

10 files changed

+75
-51
lines changed

10 files changed

+75
-51
lines changed

src/packages/frontend/support/url.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ export default function getURL(options: Options = {}) {
1717
if (!options.url) {
1818
// do not use window.location.href, since that might have extra params and anchors
1919
// which mess things up and don't help.
20-
options.url = window.location.origin + window.location.pathname;
20+
if (typeof window != "undefined") {
21+
options.url = window.location.origin + window.location.pathname;
22+
} else {
23+
// ssr
24+
options.url = "";
25+
}
2126
}
2227
// Note that this is a 2K limit on URL lengths, so the body had better
2328
// not be too large (or it gets truncated).
@@ -27,6 +32,6 @@ export default function getURL(options: Options = {}) {
2732
options.type ?? ""
2833
}&subject=${options.subject ?? ""}&body=${options.body ?? ""}&context=${
2934
options.context ?? ""
30-
}`
35+
}`,
3136
);
3237
}

src/packages/next/components/landing/content.tsx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { MAX_WIDTH_LANDING } from "lib/config";
1515
import useCustomize from "lib/use-customize";
1616
import Image from "./image";
1717
import SignIn from "./sign-in";
18+
import LiveDemo from "components/landing/live-demo";
1819

1920
// See https://github.com/vercel/next.js/issues/29788 for why we have to define this for now (it's to work around a bug).
2021
interface StaticImageData {
@@ -172,18 +173,9 @@ export default function Content(props: Props) {
172173

173174
function renderLogo() {
174175
if (typeof body === "string" || (body as StaticImageData)?.src != null) {
175-
return (
176-
<Logo
177-
logo={body}
178-
title={title}
179-
/>
180-
);
176+
return <Logo logo={body} title={title} />;
181177
} else {
182-
return (
183-
<>
184-
{body}
185-
</>
186-
);
178+
return <>{body}</>;
187179
}
188180
}
189181

@@ -222,13 +214,17 @@ export default function Content(props: Props) {
222214
{renderTitle()}
223215
{subtitle && renderSubtitleTop()}
224216
{description && (
225-
<Title
226-
level={4}
227-
style={{ color: COLORS.GRAY }}
228-
>
217+
<Title level={4} style={{ color: COLORS.GRAY }}>
229218
{description}
230219
</Title>
231220
)}
221+
<div style={{ marginTop: "15px" }}>
222+
<LiveDemo
223+
context={
224+
typeof title == "string" ? title : alt ?? "Feature Page"
225+
}
226+
/>
227+
</div>
232228
<SignIn startup={startup ?? title} hideFree={true} />
233229
</Space>
234230
</Col>

src/packages/next/components/landing/footer.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { MAX_WIDTH } from "lib/config";
1515
import { useCustomize } from "lib/customize";
1616

1717
import SocialMediaIconList from "./social-media-icon-list";
18+
import { liveDemoUrl } from "components/landing/live-demo";
1819

1920
const FOOTER_STYLE: CSS = {
2021
borderTop: "1px solid lightgrey",
@@ -68,7 +69,8 @@ export default function Footer() {
6869
header: "Product",
6970
links: [
7071
{
71-
text: "Store", url: "/store",
72+
text: "Store",
73+
url: "/store",
7274
hide: !enabledPages?.store,
7375
},
7476
{
@@ -131,6 +133,11 @@ export default function Footer() {
131133
url: "/support",
132134
hide: !enabledPages?.support,
133135
},
136+
{
137+
text: "Get a Live Demo",
138+
url: liveDemoUrl("footer"),
139+
hide: !enabledPages?.support,
140+
},
134141
],
135142
},
136143
{

src/packages/next/components/landing/header.tsx

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import { Layout } from "antd";
77
import Link from "next/link";
88
import { join } from "path";
9-
10-
import { Icon } from "@cocalc/frontend/components/icon";
119
import { IS_MOBILE } from "@cocalc/frontend/feature";
1210
import { SoftwareEnvNames } from "@cocalc/util/consts/software-envs";
1311
import { COLORS } from "@cocalc/util/theme";
@@ -20,6 +18,9 @@ import ChatGPTHelp from "components/openai/chatgpt-help";
2018
import basePath from "lib/base-path";
2119
import { useCustomize } from "lib/customize";
2220
import SubNav, { Page, SubPage } from "./sub-nav";
21+
import LiveDemo from "components/landing/live-demo";
22+
// import { Button } from "antd";
23+
// import { Icon } from "@cocalc/frontend/components/icon";
2324

2425
const GAP = "4%";
2526

@@ -67,32 +68,17 @@ export default function Header(props: Props) {
6768
<span
6869
style={{
6970
float: "right",
70-
right: 15,
71-
top: 25,
72-
color: "white",
73-
backgroundColor: COLORS.BLUE_D,
74-
outline: `1px solid ${COLORS.BLUE_DD}`,
75-
padding: "2px 8px",
76-
borderRadius: "5px",
77-
width: "100px", // CRITICAL -- this is to prevent flicker -- see https://github.com/sagemathinc/cocalc/issues/6504
71+
width: "150px", // CRITICAL -- this is to prevent flicker -- see https://github.com/sagemathinc/cocalc/issues/6504
7872
}}
7973
>
80-
<A
81-
type="primary"
74+
<LiveDemo context="header" />
75+
{/*<Button
8276
size="large"
77+
type="primary"
8378
href="/support/new?type=question&subject=&body=&title=Ask%20Us%20Anything!"
84-
title="Ask a question"
85-
style={{
86-
color: "white",
87-
display: "flex",
88-
flexDirection: "row",
89-
alignItems: "center",
90-
gap: "10px",
91-
}}
9279
>
93-
<Icon style={{ fontSize: "20px" }} name="question-circle" />{" "}
94-
<div>Contact</div>
95-
</A>
80+
<Icon style={{ fontSize: "20px" }} name="question-circle" /> Contact
81+
</Button>*/}
9682
</span>
9783
);
9884
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import getSupportUrl from "@cocalc/frontend/support/url";
2+
import { Button } from "antd";
3+
import { Icon } from "@cocalc/frontend/components/icon";
4+
import { useEffect, useState } from "react";
5+
6+
export function liveDemoUrl(context) {
7+
return getSupportUrl({
8+
subject: "Live Demo Request",
9+
type: "question",
10+
body: `I would like to request a live demo on CoCalc!\n\nWHEN IS A GOOD TIME (include timezone!):\n\n\nTELLS US AS MUCH AS YOU CAN ABOUT YOUR INTENDED USE OF COCALC:\n\n`,
11+
hideExtra: true,
12+
context,
13+
url: "",
14+
});
15+
}
16+
17+
interface Props {
18+
context: string;
19+
label?;
20+
}
21+
22+
export default function LiveDemo({ context, label }: Props) {
23+
const [href, setHref] = useState<string | undefined>(undefined);
24+
useEffect(() => {
25+
setHref(liveDemoUrl(context));
26+
}, []);
27+
return (
28+
<Button href={href} type="primary">
29+
<Icon name="users" /> {label ?? "Get a Live Demo"}
30+
</Button>
31+
);
32+
}

src/packages/next/components/landing/sign-in.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default function SignIn({ startup, hideFree, style }: Props) {
3939
title={`Open the ${siteName} app and view your projects.`}
4040
type="primary"
4141
>
42-
Your {siteName} Projects...
42+
Your {siteName} Projects
4343
</Button>
4444
</Paragraph>
4545
);

src/packages/next/components/landing/sub-nav.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const support = {
125125
new: { label: "New Ticket", hide: (customize) => !customize.zendesk },
126126
tickets: { label: "Tickets", hide: (customize) => !customize.zendesk },
127127
chatgpt: {
128-
label: "ChatGPT",
128+
label: "AI",
129129
hide: (customize) => !customize.openaiEnabled || !customize.onCoCalcCom,
130130
},
131131
} as const;

src/packages/next/pages/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ import { join } from "path";
1010
import { getRecentHeadlines } from "@cocalc/database/postgres/news";
1111
import { COLORS } from "@cocalc/util/theme";
1212
import { RecentHeadline } from "@cocalc/util/types/news";
13-
import {
14-
CoCalcComFeatures,
15-
} from "components/landing/cocalc-com-features";
13+
import { CoCalcComFeatures } from "components/landing/cocalc-com-features";
1614
import Content from "components/landing/content";
1715
import Footer from "components/landing/footer";
1816
import Head from "components/landing/head";

src/packages/next/pages/support/chatgpt.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export default function ChatgptInfo({ customize }) {
1313
function renderChatGPT() {
1414
return (
1515
<div style={{ maxWidth: "1000px" }}>
16-
Our integrated ChatGPT support is free and often very helpful since it
17-
knows so much about the open source software in {siteName}. You can ask
18-
a question below or use @chatgpt in any chat message when using{" "}
16+
Our integrated AI support is often very helpful since it knows so much
17+
about the open source software in {siteName}. You can ask a question
18+
below or use @ mention an AI model in any chat message when using{" "}
1919
{siteName}.
2020
<ChatGPTHelp
2121
style={{ marginTop: "15px" }}

src/packages/next/pages/support/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ const dataSource = [
9494
<A href="https://docs.google.com/forms/d/e/1FAIpQLSesDZkGD2XVu8BHKd_sPwn5g7MrLAA8EYRTpB6daedGVMTpkA/viewform">
9595
fill out this form and request a live video chat with us
9696
</A>
97-
. We love chatting (in English and German), and will hopefully be able
98-
to answer all of your questions.
97+
. We love chatting (in English, German and Russian), and will hopefully
98+
be able to answer all of your questions.
9999
</>
100100
),
101101
},

0 commit comments

Comments
 (0)