Skip to content

Commit

Permalink
Use the new library (#10487)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbenl authored Apr 23, 2024
1 parent f6c127b commit a7a6875
Show file tree
Hide file tree
Showing 68 changed files with 263 additions and 1,670 deletions.
14 changes: 13 additions & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
def devtools(working_directory=config.main_dir, api='https://api.replay.io/v1/graphql', subscriptions='wss://api.replay.io/v1/graphql', dispatch='wss://dispatch.replay.io', resource_deps=[]):
local_resource("devtools deps", "yarn install", deps=["package.json"], dir=working_directory, allow_parallel=True)
local_resource("devtools webpack", serve_cmd="rm -rf .next && yarn dev", deps=[], resource_deps=["devtools deps"] + resource_deps, serve_dir=working_directory, serve_env={"NEXT_PUBLIC_API_URL": api, "NEXT_PUBLIC_DISPATCH_URL": dispatch, "NEXT_PUBLIC_API_SUBSCRIPTION_URL": subscriptions})
local_resource(
"devtools webpack",
serve_cmd="rm -rf .next && npm exec next dev -- -p 8081",
deps=[],
resource_deps=["devtools deps"] + resource_deps,
serve_dir=working_directory,
serve_env={
"NEXT_PUBLIC_API_URL": api,
"NEXT_PUBLIC_DISPATCH_URL": dispatch,
"NEXT_PUBLIC_API_SUBSCRIPTION_URL": subscriptions,
"DASHBOARD_URL": "http://localhost:8080"
}
)
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/svg+xml" href="/recording/favicon.svg" />
<title>Replay</title>
<script>
(function () { var w = window; var ic = w.Intercom; if (typeof ic === "function") { ic('reattach_activator'); ic('update', w.intercomSettings); } else { var d = document; var i = function () { i.c(arguments); }; i.q = []; i.c = function (args) { i.q.push(args); }; w.Intercom = i; var l = function () { var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = 'https://widget.intercom.io/widget/k7f741xx'; var x = d.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); }; if (w.attachEvent) { w.attachEvent('onload', l); } else { w.addEventListener('load', l, false); } } })();
Expand Down
25 changes: 5 additions & 20 deletions middleware.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
import type { NextRequest } from "next/server";
import { NextResponse, userAgent } from "next/server";
import { NextResponse } from "next/server";

export function middleware(request: NextRequest) {
const { ua } = userAgent(request);

if (isMobile(ua)) {
// If the user is attempting to visit Replay on a mobile device for the first time,
// show them a message that it has not been optimized for mobile
// If they have already confirmed this message (detectable via a cookie) then let them through
const cookie = request.cookies.get("mobile-warning-dismissed");
if (cookie == null && request.nextUrl.pathname !== "/mobile-warning") {
return NextResponse.redirect(new URL("/mobile-warning", request.url));
}
const url = new URL(request.url);
if (!url.pathname.startsWith("/recording")) {
const dashboardUrl = process.env.DASHBOARD_URL || "https://replay-dashboard.vercel.app";
return NextResponse.rewrite(`${dashboardUrl}${url.pathname}${url.search}`);
}
}

// Which routes should this middleware respond to
export const config = {
matcher: ["/", "/team/:path*", "/recording/:path*"],
};

function isMobile(ua: string) {
return /iP(hone|ad|od)/.test(ua) || /Android/.test(ua);
}
4 changes: 3 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
/**
* @type {Pick<
* import('next').NextConfig,
* | 'basePath'
* | 'webpack'
* | 'experimental'
* | 'eslint'
Expand All @@ -16,6 +17,7 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
* >}
*/
const baseNextConfig = {
basePath: "/recording",
eslint: {
// which folders to run ESLint on during production builds (next build)
dirs: ["src", "pages", "packages"],
Expand Down Expand Up @@ -156,7 +158,7 @@ const baseNextConfig = {
loader: "file-loader",
options: {
name: "icon-sprite.[contenthash].svg",
publicPath: `/_next/static/images/`,
publicPath: `/recording/_next/static/images/`,
outputPath: "static/images",
},
});
Expand Down
109 changes: 0 additions & 109 deletions packages/e2e-tests/test-suite-dashboard/test-runs-01.test.ts

This file was deleted.

195 changes: 0 additions & 195 deletions packages/e2e-tests/test-suite-dashboard/test-runs-02.test.ts

This file was deleted.

Loading

0 comments on commit a7a6875

Please sign in to comment.