Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating June tracking tool #2126

Merged
merged 16 commits into from
Apr 17, 2024
Merged
3 changes: 1 addition & 2 deletions .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ NEXT_PUBLIC_EMAIL_VERIFICATION_MODE=

NEXT_PUBLIC_RECAPTCHA_SITE_KEY=
NEXT_PUBLIC_HUBSPOT_STRIPE_FORM_ID=
NEXT_PUBLIC_HUBSPOT_LOGIN_FORM_ID=
NEXT_PUBLIC_RIPE_API_KEY=
NEXT_PUBLIC_HUBSPOT_LOGIN_FORM_ID=
1 change: 1 addition & 0 deletions packages/www/components/Admin/SuspendUserModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const SuspendUserModal = ({ user, isOpen, onClose, onSuspend }: Props) => {

<Box sx={{ display: "flex", mt: 2, mb: 2 }}>
<Checkbox
placeholder="isCopyrightInfringiment"
id="isCopyrightInfringiment"
checked={isCopyrightInfringiment}
style={{ color: "black" }}
Expand Down
2 changes: 1 addition & 1 deletion packages/www/components/Admin/Table-v2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const Table = <T extends Record<string, unknown>>({
}
return (
<Box
key={`${f.type}-${f.props.columnId}`}
key={`${f.type}-${String(f.props.columnId)}`}
sx={{ ":not(:last-of-type)": { mr: 3 } }}>
{filter}
</Box>
Expand Down
2 changes: 2 additions & 0 deletions packages/www/components/ApiKeys/CreateDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const CreateDialog = ({

<Box css={{ display: "flex", mt: "$2", alignItems: "center" }}>
<Checkbox
placeholder="allowCors"
id="allowCors"
checked={allowCors}
disabled={isAdmin}
Expand Down Expand Up @@ -286,6 +287,7 @@ const CreateDialog = ({

<Box css={{ display: "flex", mt: "$2" }}>
<Checkbox
placeholder="corsFullAccess"
id="corsFullAccess"
checked={cors.fullAccess ?? false}
onCheckedChange={(checked: boolean) =>
Expand Down
10 changes: 6 additions & 4 deletions packages/www/components/ApiKeys/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from "./helpers";
import { makeCreateAction, makeSelectAction } from "../Table/helpers";
import TableStateDeleteDialog from "../Table/components/TableStateDeleteDialog";
import { useJune, events } from "hooks/use-june";

const ApiKeysTable = ({
title = "API Keys",
Expand All @@ -32,6 +33,7 @@ const ApiKeysTable = ({
const deleteDialogState = useToggleState();
const createDialogState = useToggleState();
const columns = useMemo(makeColumns, []);
const June = useJune();

const fetcher: Fetcher<ApiKeysTableData> = useCallback(
async () => rowsPageFromState(userId, getApiTokens),
Expand All @@ -50,10 +52,10 @@ const ApiKeysTable = ({
initialSortBy={[DefaultSortBy]}
emptyState={makeEmptyState(createDialogState)}
selectAction={makeSelectAction("Delete", deleteDialogState.onOn)}
createAction={makeCreateAction(
"Create API Key",
createDialogState.onOn
)}
createAction={makeCreateAction("Create API Key", () => {
June.track(events.developer.apiKeyCreate);
return createDialogState.onOn();
})}
/>

<TableStateDeleteDialog
Expand Down
1 change: 1 addition & 0 deletions packages/www/components/AssetDetails/AssetHeadingBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const AssetHeadingBox = ({ asset, totalViews }: AssetHeadingBoxProps) => {
{totalViews != undefined ? (
<Tooltip
css={{ bc: "$neutral3", color: "$neutral3" }}
// @ts-ignore
content={
<Box css={{ color: "$hiContrast" }}>
Views are defined as at least 1 second of watch time.
Expand Down
5 changes: 4 additions & 1 deletion packages/www/components/AssetDetails/AssetSharePopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ const AssetSharePopup = ({
<Popover>
<PopoverTrigger asChild>{triggerNode}</PopoverTrigger>

<PopoverContent hideArrow={false} css={{ padding: "$2" }}>
<PopoverContent
placeholder="Share"
hideArrow={false}
css={{ padding: "$2" }}>
<Flex
css={{
gap: "$1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const EmbedVideoDialog = ({
return (
<Dialog open={isOpen} onOpenChange={onOpenChange}>
<DialogContent
placeholder="Embed Video"
css={{
maxWidth: 450,
minWidth: 350,
Expand Down
6 changes: 5 additions & 1 deletion packages/www/components/FileUpload/FileItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ const FileItem = ({ fileUpload }: { fileUpload: FileUpload }) => {
{"100% uploaded"}
</Text>
) : (
<ProgressBar variant="gray" value={(progress ?? 0) * 100} />
<ProgressBar
placeholder="Progress bar"
variant="gray"
value={(progress ?? 0) * 100}
/>
);

const accessoryChildren = completed ? (
Expand Down
17 changes: 13 additions & 4 deletions packages/www/components/GettingStarted/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ const GettingStarted = ({ firstName = "" }) => {
Welcome to Livepeer Studio{firstName && `, ${firstName}`}
</Heading>
<Box css={{ bc: "$panel" }}>
<Accordion type="single" defaultValue="accordion-one">
<Accordion
placeholder="Getting Started"
type="single"
defaultValue="accordion-one">
<AccordionItem value="accordion-one">
<AccordionTrigger css={{ color: "$primary12" }}>
<AccordionTrigger
placeholder="upload video accordion"
css={{ color: "$primary12" }}>
<Text size="4" css={{ color: "inherit" }}>
Upload your first video
</Text>
Expand Down Expand Up @@ -71,7 +76,9 @@ const GettingStarted = ({ firstName = "" }) => {
</AccordionContent>
</AccordionItem>
<AccordionItem value="accordion-two">
<AccordionTrigger css={{ color: "$primary12" }}>
<AccordionTrigger
placeholder="Create your first livestream"
css={{ color: "$primary12" }}>
<Text size="4" css={{ color: "inherit" }}>
Create your first livestream
</Text>
Expand Down Expand Up @@ -121,7 +128,9 @@ const GettingStarted = ({ firstName = "" }) => {
</AccordionContent>
</AccordionItem>
<AccordionItem value="accordion-three">
<AccordionTrigger css={{ color: "$primary12" }}>
<AccordionTrigger
placeholder="Integrate with your app"
css={{ color: "$primary12" }}>
<Text size="4" css={{ color: "inherit" }}>
Integrate with your app
</Text>
Expand Down
5 changes: 5 additions & 0 deletions packages/www/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import PolygonIcon from "../../public/img/icons/polygonWithoutBorderBottom.svg";
import CheckedIcon from "../../public/img/icons/checked.svg";
import { useEffect, useState, useRef } from "react";
import { useApi, useHubspotForm } from "hooks";
import { useJune, events } from "hooks/use-june";

const StyledHornIcon = styled(HornIcon, {
color: "$hiContrast",
Expand Down Expand Up @@ -53,6 +54,7 @@ const Header = ({ breadcrumbs = [] }) => {
portalId: process.env.NEXT_PUBLIC_HUBSPOT_PORTAL_ID,
formId: process.env.NEXT_PUBLIC_HUBSPOT_FEEDBACK_FORM_ID,
});
const June = useJune();

useEffect(() => {
if (data) {
Expand Down Expand Up @@ -111,6 +113,7 @@ const Header = ({ breadcrumbs = [] }) => {
as={A}
target="_blank"
size={2}
onClick={() => June.track(events.all.documentation)}
css={{
cursor: "default",
color: "$hiContrast",
Expand All @@ -131,6 +134,7 @@ const Header = ({ breadcrumbs = [] }) => {
<Button
ghost
as={DropdownMenuTrigger}
onClick={() => June.track(events.all.feedback)}
size={2}
css={{
mr: "$2",
Expand All @@ -147,6 +151,7 @@ const Header = ({ breadcrumbs = [] }) => {
<Box>Feedback</Box>
</Button>
<DropdownMenuContent
placeholder="Feedback"
css={{
padding: "18px 0 12px",
position: "relative",
Expand Down
9 changes: 8 additions & 1 deletion packages/www/components/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { useApi } from "../../hooks";
import Router from "next/router";
import { RocketIcon, ChatBubbleIcon, LoopIcon } from "@radix-ui/react-icons";
import Contact from "../Contact";
import { useJune, events } from "hooks/use-june";

export const NavLink = styled(A, {
fontSize: 14,
Expand Down Expand Up @@ -72,6 +73,9 @@ export type SidebarId =

const Sidebar = ({ id }: { id: SidebarId }) => {
const { user, logout } = useApi();
const June = useJune();

June?.track(`sidebar ${id}`);

return (
<Box
Expand All @@ -97,6 +101,7 @@ const Sidebar = ({ id }: { id: SidebarId }) => {
p: 0,
}}>
<Avatar
placeholder="user"
size="3"
alt={user?.firstName}
fallback={
Expand All @@ -116,7 +121,9 @@ const Sidebar = ({ id }: { id: SidebarId }) => {
css={{ width: 20, height: 20, color: "$hiContrast" }}
/>
</Flex>
<DropdownMenuContent css={{ border: "1px solid $colors$neutral6" }}>
<DropdownMenuContent
placeholder="dropdown-menu-content"
css={{ border: "1px solid $colors$neutral6" }}>
<DropdownMenuGroup>
<DropdownMenuItem
key="billing-dropdown-item"
Expand Down
1 change: 1 addition & 0 deletions packages/www/components/Site/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const queryClient = new QueryClient();

function useSiteConfig() {
return useQuery(["siteConfig"], async () => {
// @ts-ignore
const { SiteConfig } = await request(
"https://dp4k3mpw.api.sanity.io/v1/graphql/production/default",
print(siteConfig)
Expand Down
1 change: 1 addition & 0 deletions packages/www/components/Site/Navigation/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ const NavigationBase = ({
</A>
</DropdownMenuTrigger>
<DropdownMenuContent
placeholder="dropdown-menu-content"
align="start"
css={{
p: 0,
Expand Down
1 change: 1 addition & 0 deletions packages/www/components/Site/OneAPI/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export const StartBuilding = ({ backgroundColor = "$loContrast" }) => (
justifyContent: "center",
}}>
<TabsList
placeholder="Select a workflow"
css={{
alignSelf: "center",
width: "auto",
Expand Down
2 changes: 2 additions & 0 deletions packages/www/components/Site/RegionSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useState } from "react";

const Item = ({ active = false, language, locale, flag, ...props }) => (
<DropdownMenuCheckboxItem
placeholder="Language"
css={{
borderRadius: 3,
display: "flex",
Expand Down Expand Up @@ -97,6 +98,7 @@ const LanguageDropdown = ({ navBackgroundColor }) => {
</Box>
</DropdownMenuTrigger>
<DropdownMenuContent
placeholder="dropdown-menu-content"
css={{
minWidth: 300,
backgroundColor: "#ffffff",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ const SaveTargetDialog = ({
{profileOpts.map((p) => (
<Box key={p.name} css={{ display: "flex", mb: "$2" }}>
<Radio
placeholder="Profile"
value={p.name}
id={`profile-${p.name}`}
checked={state.profile === p.name}
Expand All @@ -339,6 +340,7 @@ const SaveTargetDialog = ({

<Box css={{ display: "flex" }}>
<Checkbox
placeholder="videoOnly"
id="videoOnly"
checked={state.videoOnly}
onCheckedChange={(checked: boolean) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ const Toolbox = ({
return (
<Flex align="center" gap="2" justify="end">
<Switch
placeholder="Multistream target toggle"
name="multistream-target-toggle"
disabled={!target}
checked={!target?.disabled}
Expand All @@ -234,7 +235,7 @@ const Toolbox = ({
<Overflow />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuContent placeholder="dropdown-menu-content" align="end">
<DropdownMenuGroup>
<DropdownMenuItem
disabled={!target}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import SaveTargetDialog, { Action } from "./SaveTargetDialog";
import { makeColumns, makeTableData, TargetsTableData } from "./helpers";
import { makeCreateAction } from "components/Table/helpers";
import { getMultistreamTarget } from "hooks/use-api/endpoints/multistream";
import { useJune, events } from "hooks/use-june";

const MultistreamTargetsTable = ({
title = "Multistream Targets",
Expand Down Expand Up @@ -41,6 +42,7 @@ const MultistreamTargetsTable = ({
const saveDialogState = useToggleState();

const columns = useMemo(makeColumns, []);
const June = useJune();

const targetQueryKey = (id: string) => ["multistreamTarget", id];
const invalidateTargetId = useCallback(
Expand Down Expand Up @@ -75,7 +77,10 @@ const MultistreamTargetsTable = ({
[state.tableId, stream, streamHealth, invalidateTargetId, targetRefs]
);

const onCreateClick = saveDialogState.onOn;
const onCreateClick = () => {
June.track(events.stream.multistreamTarget);
return saveDialogState.onOn();
};

return (
<Box {...props}>
Expand Down
4 changes: 4 additions & 0 deletions packages/www/components/StreamDetails/Record.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ import {
import { useToggleState } from "hooks/use-toggle-state";
import { useApi } from "../../hooks";
import ErrorDialog from "../ErrorDialog";
import { useJune, events } from "hooks/use-june";

const Record = ({ stream, invalidate, isSwitch = true }) => {
const { patchStream } = useApi();
const [openSnackbar] = useSnackbar();
const errorRecordDialogState = useToggleState();
const June = useJune();

const onCheckedChange = async () => {
June.track(events.stream.recordingToggle);
if (stream.isActive) {
errorRecordDialogState.onOn();
} else if (!stream.record) {
Expand All @@ -31,6 +34,7 @@ const Record = ({ stream, invalidate, isSwitch = true }) => {
<Box>
{isSwitch ? (
<Switch
placeholder="Record mode"
checked={!!stream.record}
name="record-mode"
value={`${!!stream.record}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const StreamChildrenHeadingBox = ({
<Box as={ChevronDownIcon} css={{ ml: "$1" }} />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuContent placeholder="dropdown-menu-content" align="end">
<DropdownMenuGroup>
<Record
stream={stream}
Expand Down
4 changes: 4 additions & 0 deletions packages/www/components/StreamDetails/StreamHealthTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Logger from "components/Logger";
import Chart from "components/Chart";
import HealthChecksTable from "components/StreamDetails/HealthChecksTable";
import { Text, Box, Heading } from "@livepeer/design-system";
import { useJune, events } from "hooks/use-june";

const ingestInterval = 10 * 1000;
const maxItems = 6;
Expand All @@ -25,6 +26,7 @@ const StreamHealthTab = ({ stream, streamHealth, invalidateStream }) => {
{ name: 0, "Session bitrate": 0 },
]);

const June = useJune();
const [multiDataChart, setMultiDataChart] = useState<MultistreamChartType[]>(
[]
);
Expand All @@ -33,6 +35,8 @@ const StreamHealthTab = ({ stream, streamHealth, invalidateStream }) => {

const [info, setInfo] = useState<StreamInfo | null>(null);

June?.track(events.stream.health);

const { getStreamInfo } = useApi();

const { query } = router;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const StreamOverviewBox = ({
</Box>
<Tooltip
multiline
// @ts-ignore
content={
<Box>
When enabled, transcoded streaming sessions will be recorded
Expand Down
Loading
Loading