Skip to content

Commit e45fd67

Browse files
committed
next: start working on video call links, typing and emphasize sign up/in on index page
1 parent 3326913 commit e45fd67

File tree

10 files changed

+67
-29
lines changed

10 files changed

+67
-29
lines changed

src/packages/database/settings/customize.ts

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default async function getCustomize(
7777
imprint: settings.imprint,
7878
policies: settings.policies,
7979
support: settings.support,
80+
supportVideoCall: settings.support_video_call,
8081

8182
// Is important for invite emails, password reset, etc. (e.g., so we can construct a url to our site).
8283
// This *can* start with http:// to explicitly use http instead of https, and can end

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export default function Content(props: Props) {
224224
}
225225
/>
226226
</div>
227-
<SignIn startup={startup ?? title} hideFree={true} />
227+
<SignIn startup={startup ?? title} hideFree={true} emphasize />
228228
</Space>
229229
</Col>
230230
<Col sm={14} xs={24}>

src/packages/next/components/landing/index-list.tsx

+25-10
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,19 @@ export interface Item {
2222
logoBackground?: string; // #color
2323
image?: StaticImageData;
2424
imageWidth?: string;
25-
description: ReactNode;
25+
description: ReactNode | ((customize: CustomizeType) => ReactNode);
2626
shareServer?: boolean; // only show if the share server is enabled
2727
landingPages?: boolean; // only show if landing pages are enabled.
2828
hide?: (customize: CustomizeType) => boolean; // if returns true, then this item will be hidden.
2929
}
3030

3131
export type DataSource = Item[];
3232

33+
// replaces the description attribute by {description: ReactNode}
34+
type ItemProcessed = Omit<Item, "description"> & {
35+
description: ReactNode;
36+
};
37+
3338
interface Props {
3439
title: ReactNode;
3540
description: ReactNode;
@@ -41,13 +46,23 @@ interface Props {
4146
export default function IndexList({ title, description, dataSource }: Props) {
4247
const customize = useCustomize();
4348
const { shareServer, landingPages } = customize;
44-
const filteredDataSource = useMemo(() => {
45-
return dataSource.filter((item) => {
46-
if (item.shareServer && !shareServer) return false;
47-
if (item.landingPages && !landingPages) return false;
48-
if (item.hide?.(customize)) return false;
49-
return true;
50-
});
49+
const filteredDataSource: ItemProcessed[] = useMemo(() => {
50+
return dataSource
51+
.filter((item) => {
52+
if (item.shareServer && !shareServer) return false;
53+
if (item.landingPages && !landingPages) return false;
54+
if (item.hide?.(customize)) return false;
55+
return true;
56+
})
57+
.map((item) => {
58+
return {
59+
...item,
60+
description:
61+
typeof item.description === "function"
62+
? item.description(customize)
63+
: item.description,
64+
};
65+
});
5166
}, [shareServer, landingPages, dataSource]);
5267
return (
5368
<Layout.Content
@@ -80,8 +95,8 @@ export default function IndexList({ title, description, dataSource }: Props) {
8095
);
8196
}
8297

83-
function DataList({ dataSource }: { dataSource: Item[] }) {
84-
function renderItem(item): ReactNode {
98+
function DataList({ dataSource }: { dataSource: ItemProcessed[] }) {
99+
function renderItem(item: ItemProcessed): ReactNode {
85100
const icon = (
86101
<div>
87102
{isValidElement(item.logo) ? (

src/packages/next/components/landing/live-demo.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import getSupportUrl from "@cocalc/frontend/support/url";
21
import { Button } from "antd";
3-
import { Icon } from "@cocalc/frontend/components/icon";
42
import { useEffect, useState } from "react";
53

4+
import { Icon } from "@cocalc/frontend/components/icon";
5+
import getSupportUrl from "@cocalc/frontend/support/url";
6+
67
export function liveDemoUrl(context) {
78
return getSupportUrl({
89
subject: "Contact Us!",

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface Props {
1717
startup?: ReactNode; // customize the button, e.g. "Start Jupyter Now".
1818
hideFree?: boolean;
1919
style?: React.CSSProperties;
20+
emphasize?: boolean;
2021
}
2122

2223
const STYLE: CSSProperties = {
@@ -25,7 +26,7 @@ const STYLE: CSSProperties = {
2526
marginBottom: "0",
2627
} as const;
2728

28-
export default function SignIn({ startup, hideFree, style }: Props) {
29+
export default function SignIn({ startup, hideFree, style, emphasize }: Props) {
2930
const { anonymousSignup, siteName, account, emailSignup } = useCustomize();
3031
style = { ...STYLE, ...style };
3132
const router = useRouter();
@@ -55,6 +56,7 @@ export default function SignIn({ startup, hideFree, style }: Props) {
5556
style={{ margin: "10px" }}
5657
title={"Create a new account."}
5758
onClick={() => router.push("/auth/sign-up")}
59+
type={emphasize ? "primary" : undefined}
5860
>
5961
Sign Up
6062
</Button>
@@ -65,6 +67,7 @@ export default function SignIn({ startup, hideFree, style }: Props) {
6567
"Either create a new account or sign into an existing account."
6668
}
6769
onClick={() => router.push("/auth/sign-in")}
70+
type={emphasize ? "primary" : undefined}
6871
>
6972
Sign In
7073
</Button>

src/packages/next/lib/customize.ts

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ interface Customize extends ServerCustomize {
7070
computeServersEnabled?: boolean; // backend configured to run on external compute servers
7171
enabledPages?: EnabledPageTree; // tree structure which specifies supported routes for this install
7272
support?: string; // HTML/MD to replace the generic support pages
73+
supportVideoCall?: string;
7374
}
7475

7576
const CustomizeContext = createContext<Partial<Customize>>({});

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
* License: MS-RSL – see LICENSE.md for details
44
*/
55

6+
import { Layout } from "antd";
7+
68
import Footer from "components/landing/footer";
79
import Head from "components/landing/head";
810
import Header from "components/landing/header";
911
import IndexList, { DataSource } from "components/landing/index-list";
1012
import A from "components/misc/A";
1113
import { Customize } from "lib/customize";
1214
import withCustomize from "lib/with-customize";
13-
import { Layout } from "antd";
1415

1516
const dataSource: DataSource = [
1617
{

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

+20-14
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,39 @@ import { Col, Layout } from "antd";
33
import Footer from "components/landing/footer";
44
import Head from "components/landing/head";
55
import Header from "components/landing/header";
6-
import A from "components/misc/A";
7-
import ChatGPTHelp from "components/openai/chatgpt-help";
8-
import { Customize } from "lib/customize";
9-
import withCustomize from "lib/with-customize";
10-
import { VideoItem } from "components/videos";
116
import IndexList, { DataSource } from "components/landing/index-list";
7+
import SocialMediaIconList from "components/landing/social-media-icon-list";
128
import { Title } from "components/misc";
9+
import A from "components/misc/A";
1310
import SanitizedMarkdown from "components/misc/sanitized-markdown";
14-
import SocialMediaIconList from "components/landing/social-media-icon-list";
11+
import ChatGPTHelp from "components/openai/chatgpt-help";
12+
import { VideoItem } from "components/videos";
13+
import { Customize, type CustomizeType } from "lib/customize";
14+
import withCustomize from "lib/with-customize";
1515

1616
const dataSource = [
1717
{
1818
link: "/support/new",
1919
title: "Create a New Support Ticket",
2020
logo: "medkit",
2121
hide: (customize) => !customize.zendesk,
22-
description: (
22+
description: ({ supportVideoCall }: CustomizeType) => (
2323
<>
2424
If you are having any trouble or just have a question,{" "}
2525
<A href="/support/new">
2626
<b>create a support ticket</b>{" "}
2727
</A>
28-
or{" "}
29-
<A href="https://calendly.com/cocalc">
30-
<b>book a video chat</b>
31-
</A>
32-
. You do NOT have to be a paying customer to open a ticket.
28+
{supportVideoCall ? (
29+
<>
30+
or{" "}
31+
<A href={supportVideoCall}>
32+
<b>book a video chat</b>
33+
</A>
34+
</>
35+
) : (
36+
""
37+
)}
38+
. You do NOT have to be a paying customer to contact us!
3339
<VideoItem
3440
width={800}
3541
style={{ margin: "15px 0" }}
@@ -56,7 +62,7 @@ const dataSource = [
5662
{
5763
link: "https://calendly.com/cocalc",
5864
title: "Book a Video Chat",
59-
logo: "video",
65+
logo: "video-camera",
6066
description: (
6167
<>
6268
Book a{" "}
@@ -130,7 +136,7 @@ const dataSource = [
130136
</>
131137
),
132138
},
133-
] as DataSource;
139+
] as const satisfies DataSource;
134140

135141
export default function Preferences({ customize }) {
136142
const { support, onCoCalcCom } = customize;

src/packages/util/db-schema/server-settings.ts

+1
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,5 @@ export interface Customize {
128128
cloudFilesystemsEnabled?: boolean;
129129
githubProjectId?: string;
130130
support?: string;
131+
supportVideoCall?: string;
131132
}

src/packages/util/db-schema/site-defaults.ts

+9
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export type SiteSettingsKeys =
6262
| "imprint"
6363
| "policies"
6464
| "support"
65+
| "support_video_call"
6566
| "openai_enabled"
6667
| "google_vertexai_enabled"
6768
| "mistral_enabled"
@@ -522,6 +523,14 @@ export const site_settings_conf: SiteSettings = {
522523
multiline: 5,
523524
tags: ["Theme"],
524525
},
526+
support_video_call: {
527+
name: "Video Call for Support",
528+
desc: "Link to a form to book a video call.",
529+
default: "https://calendly.com/cocalc/discovery?back=1",
530+
clearable: true,
531+
show: (conf) => show_theming_vars(conf) && only_cocalc_com(conf),
532+
tags: ["Theme"],
533+
},
525534
// ============== END THEMING ============
526535

527536
versions: {

0 commit comments

Comments
 (0)