mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-24 12:42:38 +00:00
Progress Portal access hint links to its troubleshooting article
Both variants end with a muted "Learn more" to troubleshooting/progress-portal-only in the customer docs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
import { SUPPORT_EMAIL } from "@/lib/supportContact";
|
||||
import { DOCS_URL } from "@/utils/config";
|
||||
import type { ProgressAccessHint as Hint } from "../hooks/progressAccessHint";
|
||||
|
||||
export const ACCESS_HINT_DOCS_URL = `${DOCS_URL}/troubleshooting/progress-portal-only`;
|
||||
|
||||
const LINK_CLASS = "text-green-700 underline hover:text-green-800";
|
||||
|
||||
/** One muted line below the search telling a member without a role whom to ask for the full portal. */
|
||||
export function ProgressAccessHint({ hint }: { hint: Hint }) {
|
||||
const learnMore = (
|
||||
<a href={ACCESS_HINT_DOCS_URL} target="_blank" rel="noopener noreferrer" className={LINK_CLASS}>
|
||||
Learn more
|
||||
</a>
|
||||
);
|
||||
|
||||
if (hint.kind === "member") {
|
||||
return (
|
||||
<p className="mt-10 text-center text-sm text-gray-500">
|
||||
{"Looking for the full portal? Your organization already uses Autopilot Monitor. Ask your Autopilot Monitor admin for a role."}
|
||||
{" "}
|
||||
{learnMore}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
@@ -16,11 +29,13 @@ export function ProgressAccessHint({ hint }: { hint: Hint }) {
|
||||
<p className="mt-10 text-center text-sm text-gray-500">
|
||||
{`Looking for the full portal? Your organization signed up for Autopilot Monitor${signedUp}, but no device has been monitored recently. Ask your Autopilot Monitor admin for a role, or write to`}
|
||||
{" "}
|
||||
<a href={`mailto:${SUPPORT_EMAIL}`} className="text-green-700 underline hover:text-green-800">
|
||||
<a href={`mailto:${SUPPORT_EMAIL}`} className={LINK_CLASS}>
|
||||
{SUPPORT_EMAIL}
|
||||
</a>
|
||||
{" "}
|
||||
{"if no one looks after it anymore."}
|
||||
{" "}
|
||||
{learnMore}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
+12
-1
@@ -1,8 +1,9 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { ProgressAccessHint } from "../ProgressAccessHint";
|
||||
import { ACCESS_HINT_DOCS_URL, ProgressAccessHint } from "../ProgressAccessHint";
|
||||
import { SUPPORT_EMAIL } from "@/lib/supportContact";
|
||||
import { DOCS_URL } from "@/utils/config";
|
||||
|
||||
const render = (hint: Parameters<typeof ProgressAccessHint>[0]["hint"]) =>
|
||||
renderToStaticMarkup(createElement(ProgressAccessHint, { hint }));
|
||||
@@ -30,4 +31,14 @@ describe("ProgressAccessHint", () => {
|
||||
|
||||
expect(html).toContain("signed up for Autopilot Monitor, but no device");
|
||||
});
|
||||
|
||||
it("links both variants to the troubleshooting article, after a space", () => {
|
||||
// The article's path is in the docs navigation; renaming it there breaks this link.
|
||||
expect(ACCESS_HINT_DOCS_URL).toBe(`${DOCS_URL}/troubleshooting/progress-portal-only`);
|
||||
for (const hint of [{ kind: "member" as const }, { kind: "unused" as const, signedUpOn: null }]) {
|
||||
expect(render(hint)).toMatch(
|
||||
new RegExp(`[.] <a href="${ACCESS_HINT_DOCS_URL.replace(/[.]/g, "[.]")}" target="_blank" rel="noopener noreferrer"[^>]*>Learn more</a>`),
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user