Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

improved modal copy

Steven Tey7e0fe226d400
diff --git a/app/ui/button.tsx b/app/ui/button.tsx
index 73eae4409d..030ab84949 100644
--- a/app/ui/button.tsx
+++ b/app/ui/button.tsx
@@ -8,6 +8,7 @@ import { ReactNode } from "react";
export default function Button({
text,
variant = "primary",
+ className,
onClick,
disabled,
loading,
@@ -16,6 +17,7 @@ export default function Button({
}: {
text: string;
variant?: "primary" | "secondary" | "success" | "danger";
+ className?: string;
onClick?: any;
disabled?: boolean;
loading?: boolean;
@@ -49,6 +51,7 @@ export default function Button({
"border-red-500 bg-red-500 text-white hover:bg-white hover:text-red-500":
variant === "danger",
},
+ className,
)}
{...(onClick ? { onClick } : {})}
disabled={disabled || loading}
diff --git a/components/app/modals/saml-modal.tsx b/components/app/modals/saml-modal.tsx
index b31bf3315d..c8ffe3a8b7 100644
--- a/components/app/modals/saml-modal.tsx
+++ b/components/app/modals/saml-modal.tsx
@@ -29,6 +29,11 @@ function SAMLModal({
const [submitting, setSubmitting] = useState(false);
const { mutate } = useSAML();
+ const currentProvider = useMemo(
+ () => SAML_PROVIDERS.find((p) => p.saml === selectedProvider),
+ [selectedProvider],
+ );
+
return (
<Modal showModal={showSAMLModal} setShowModal={setShowSAMLModal}>
<div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 px-4 py-8 sm:px-16">
@@ -98,15 +103,13 @@ function SAMLModal({
</option>
))}
</select>
- {selectedProvider ? (
+ {currentProvider ? (
<a
href={`${HOME_DOMAIN}/help/article/${selectedProvider}-saml`}
target="_blank"
className="ml-2 mt-2 block text-sm text-gray-500 underline"
>
- Read the guide on{" "}
- {SAML_PROVIDERS.find((p) => p.saml === selectedProvider)?.name}{" "}
- SSO
+ Read the guide on {currentProvider.name} SSO
</a>
) : (
<a
@@ -119,34 +122,35 @@ function SAMLModal({
)}
</div>
- {(selectedProvider === "okta" || selectedProvider === "azure") && (
- <div className="border-t border-gray-200 pt-4">
- <div className="flex items-center space-x-1">
- <h2 className="text-sm font-medium text-gray-900">
- Metadata URL
- </h2>
- <InfoTooltip
- content={
- <SimpleTooltipContent
- title="Your metadata URL is the URL to your SAML provider's metadata."
- cta="Learn more."
- href={`${HOME_DOMAIN}/help/article/${selectedProvider}-saml#step-4-copy-the-metadata-url`}
- />
- }
+ {currentProvider &&
+ (selectedProvider === "okta" || selectedProvider === "azure") && (
+ <div className="border-t border-gray-200 pt-4">
+ <div className="flex items-center space-x-1">
+ <h2 className="text-sm font-medium text-gray-900">
+ {currentProvider.samlModalCopy.url}
+ </h2>
+ <InfoTooltip
+ content={
+ <SimpleTooltipContent
+ title={`Your ${currentProvider.samlModalCopy.url} is the URL to your SAML provider's metadata.`}
+ cta="Learn more."
+ href={`${HOME_DOMAIN}/help/article/${selectedProvider}-saml#step-4-copy-the-metadata-url`}
+ />
+ }
+ />
+ </div>
+ <input
+ id="metadataUrl"
+ name="metadataUrl"
+ autoFocus
+ type="url"
+ placeholder="https://"
+ autoComplete="off"
+ required
+ className="mt-1 block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-black focus:outline-none focus:ring-black sm:text-sm"
/>
</div>
- <input
- id="metadataUrl"
- name="metadataUrl"
- autoFocus
- type="url"
- placeholder="https://"
- autoComplete="off"
- required
- className="mt-1 block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-black focus:outline-none focus:ring-black sm:text-sm"
- />
- </div>
- )}
+ )}
<Button
text="Save changes"
disabled={!selectedProvider}
diff --git a/components/app/modals/scim-modal.tsx b/components/app/modals/scim-modal.tsx
index 6dc2d3da32..d41c64513c 100644
--- a/components/app/modals/scim-modal.tsx
+++ b/components/app/modals/scim-modal.tsx
@@ -37,7 +37,7 @@ function SCIMModal({
const currentProvider = useMemo(
() => SAML_PROVIDERS.find((p) => p.scim === selectedProvider),
[selectedProvider],
- ) as SAMLProviderProps;
+ );
return (
<Modal showModal={showSCIMModal} setShowModal={setShowSCIMModal}>
@@ -97,7 +97,6 @@ function SCIMModal({
setSubmitting(false);
});
}}
- className="flex flex-col space-y-4"
>
<div>
<div className="flex items-center space-x-1">
@@ -110,7 +109,7 @@ function SCIMModal({
title="Your directory provider is the IDP you use to manage your users."
cta={selectedProvider ? "Read the guide." : "Learn more."}
href={`${HOME_DOMAIN}/help/${
- selectedProvider
+ currentProvider
? `article/${currentProvider.saml}-scim`
: "category/saml-sso"
}`}
@@ -143,8 +142,18 @@ function SCIMModal({
</select>
</div>
- {configured && selectedProvider === provider && (
- <>
+ {currentProvider && (
+ <a
+ href={`${HOME_DOMAIN}/help/article/${currentProvider.saml}-scim`}
+ target="_blank"
+ className="ml-2 mt-2 block text-sm text-gray-500 underline"
+ >
+ Read the guide on {currentProvider.name} SCIM
+ </a>
+ )}
+
+ {currentProvider && selectedProvider === provider && (
+ <div className="mt-4 flex flex-col space-y-4">
<div className="w-full border-t border-gray-200" />
<div>
<div className="flex items-center space-x-1">
@@ -156,7 +165,7 @@ function SCIMModal({
<SimpleTooltipContent
title="Your directory provider is the IDP you use to manage your users."
cta="Read the guide."
- href={`${HOME_DOMAIN}/help/article/configuring-scim`}
+ href={`${HOME_DOMAIN}/help/article/${currentProvider.saml}-scim`}
/>
}
/>
@@ -196,7 +205,7 @@ function SCIMModal({
<SimpleTooltipContent
title="Your directory provider is the IDP you use to manage your users."
cta="Read the guide."
- href={`${HOME_DOMAIN}/help/article/configuring-scim`}
+ href={`${HOME_DOMAIN}/help/article/${currentProvider.saml}-scim`}
/>
}
/>
@@ -240,9 +249,10 @@ function SCIMModal({
</div>
</div>
</div>
- </>
+ </div>
)}
<Button
+ className="mt-4"
text="Save changes"
loading={submitting}
disabled={selectedProvider && selectedProvider === provider}
diff --git a/lib/constants/index.ts b/lib/constants/index.ts
index 572714ecf1..ae669fb33c 100644
--- a/lib/constants/index.ts
+++ b/lib/constants/index.ts
@@ -168,6 +168,9 @@ export const SAML_PROVIDERS = [
name: "Okta",
logo: "/_static/icons/okta.svg",
saml: "okta",
+ samlModalCopy: {
+ url: "Metadata URL",
+ },
scim: "okta-scim-v2",
scimModalCopy: {
url: "SCIM 2.0 Base URL",
@@ -178,6 +181,9 @@ export const SAML_PROVIDERS = [
name: "Azure AD",
logo: "/_static/icons/azure.svg",
saml: "azure",
+ samlModalCopy: {
+ url: "App Federation Metadata URL",
+ },
scim: "azure-scim-v2",
scimModalCopy: {
url: "Tenant URL",
@@ -188,6 +194,9 @@ export const SAML_PROVIDERS = [
name: "Google Workspace",
logo: "/_static/icons/google.svg",
saml: "google",
+ samlModalCopy: {
+ url: "Metadata URL",
+ },
scim: "google",
scimModalCopy: {
url: "SCIM 2.0 Base URL",
diff --git a/lib/types.ts b/lib/types.ts
index da9f8620ea..9dce45d1a9 100644
--- a/lib/types.ts
+++ b/lib/types.ts
@@ -122,6 +122,9 @@ export interface SAMLProviderProps {
name: string;
logo: string;
saml: "okta" | "azure" | "google";
+ samlModalCopy: {
+ url: string;
+ };
scim: keyof typeof DirectorySyncProviders;
scimModalCopy: {
url: string;