mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
a06671e8ce
This PR contains the necessary work to make Outline an OAuth provider including: - OAuth app registration - OAuth app management - Private / public apps (Public in cloud only) - Full OAuth 2.0 spec compatible authentication flow - Granular scopes - User token management screen in settings - Associated API endpoints for programatic access
61 lines
1.3 KiB
TypeScript
61 lines
1.3 KiB
TypeScript
import { BackIcon } from "outline-icons";
|
|
import * as React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import styled from "styled-components";
|
|
import { parseDomain } from "@shared/utils/domains";
|
|
import { Config } from "~/stores/AuthStore";
|
|
import env from "~/env";
|
|
import Desktop from "~/utils/Desktop";
|
|
import isCloudHosted from "~/utils/isCloudHosted";
|
|
|
|
type Props = {
|
|
config?: Config;
|
|
onBack?: () => void;
|
|
};
|
|
|
|
export function BackButton({ onBack, config }: Props) {
|
|
const { t } = useTranslation();
|
|
const isSubdomain = !!config?.hostname;
|
|
|
|
if (onBack) {
|
|
return (
|
|
<Link onClick={onBack}>
|
|
<BackIcon /> {t("Back")}
|
|
</Link>
|
|
);
|
|
}
|
|
|
|
if (!isCloudHosted || parseDomain(window.location.origin).custom) {
|
|
return null;
|
|
}
|
|
|
|
if (Desktop.isElectron() && !isSubdomain) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Link href={isSubdomain ? env.URL : "https://www.getoutline.com"}>
|
|
<BackIcon /> {Desktop.isElectron() ? t("Back") : t("Back to home")}
|
|
</Link>
|
|
);
|
|
}
|
|
|
|
const Link = styled.a`
|
|
display: flex;
|
|
align-items: center;
|
|
color: inherit;
|
|
padding: ${Desktop.isElectron() ? "48px 32px" : "32px"};
|
|
font-weight: 500;
|
|
position: absolute;
|
|
|
|
svg {
|
|
transition: transform 100ms ease-in-out;
|
|
}
|
|
|
|
&:hover {
|
|
svg {
|
|
transform: translateX(-4px);
|
|
}
|
|
}
|
|
`;
|