mirror of
https://github.com/outline/outline.git
synced 2026-11-27 16:08:58 +03:00
Integration page skeleton
This commit is contained in:
1 parent
b48498d07f
commit
a5f593d68d
5 files changed
+118
-77
No files matched your search
@@ -1,87 +1,62 @@
|
||||
import * as React from "react";
|
||||
import styled, { useTheme } from "styled-components";
|
||||
import Icon from "@shared/components/Icon";
|
||||
import Squircle from "@shared/components/Squircle";
|
||||
import { s, hover, ellipsis } from "@shared/styles";
|
||||
import Button from "~/components/ActionButton";
|
||||
|
||||
export type Integration = {
|
||||
id: string;
|
||||
name: string;
|
||||
icon?: string;
|
||||
description: string;
|
||||
isActive: boolean;
|
||||
};
|
||||
import { Link } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import { s, ellipsis } from "@shared/styles";
|
||||
import { ConfigItem } from "~/hooks/useSettingsConfig";
|
||||
import Flex from "./Flex";
|
||||
|
||||
type Props = {
|
||||
integration: Integration;
|
||||
onInstall: (id: string) => void;
|
||||
onConfigure: (id: string) => void;
|
||||
integration: ConfigItem;
|
||||
};
|
||||
|
||||
const IntegrationCard: React.FC<Props> = ({
|
||||
integration,
|
||||
onInstall,
|
||||
onConfigure,
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
|
||||
function IntegrationCard({ integration }: Props) {
|
||||
const actionText = integration.isActive ? "Configure" : "Install";
|
||||
return (
|
||||
<Card>
|
||||
<IconWrapper>
|
||||
{integration.icon ? (
|
||||
<Squircle color={theme.slateLight}>
|
||||
<Icon value={integration.icon} size={24} />
|
||||
</Squircle>
|
||||
) : (
|
||||
<Squircle color={theme.slateLight}>
|
||||
<Icon value="puzzle" size={24} />
|
||||
</Squircle>
|
||||
)}
|
||||
</IconWrapper>
|
||||
<Content>
|
||||
<Card tabIndex={0}>
|
||||
<Flex align="center" gap={20}>
|
||||
<integration.icon size={50} />
|
||||
<Name>{integration.name}</Name>
|
||||
<Description>{integration.description}</Description>
|
||||
</Flex>
|
||||
|
||||
<Content>
|
||||
{/* <Description>{integration.description}</Description> */}
|
||||
</Content>
|
||||
|
||||
<Footer>
|
||||
<Status isActive={integration.isActive}>
|
||||
{integration.isActive ? "isActive" : "Not isActive"}
|
||||
<Status isActive={integration.isActive || false}>
|
||||
{integration.isActive ? "Active" : "Not Active"}
|
||||
</Status>
|
||||
{integration.isActive ? (
|
||||
<ActionButton onClick={() => onConfigure(integration.id)}>
|
||||
Configure
|
||||
</ActionButton>
|
||||
) : (
|
||||
<ActionButton onClick={() => onInstall(integration.id)}>
|
||||
Install
|
||||
</ActionButton>
|
||||
)}
|
||||
<ActionLink
|
||||
to={integration.path}
|
||||
onClick={(e) => {
|
||||
if (!integration.isActive) {
|
||||
e.preventDefault();
|
||||
}
|
||||
// Otherwise let the <Link> navigate to the configure route
|
||||
}}
|
||||
>
|
||||
{actionText}
|
||||
</ActionLink>
|
||||
</Footer>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default IntegrationCard;
|
||||
|
||||
// — styled-components — //
|
||||
|
||||
const Card = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 12px;
|
||||
width: 200px;
|
||||
height: 220px;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
background: ${s("background")};
|
||||
border: 1px solid ${s("inputBorder")};
|
||||
border-radius: 8px;
|
||||
transition: box-shadow 200ms ease;
|
||||
cursor: pointer;
|
||||
|
||||
&: ${hover} {
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
`;
|
||||
|
||||
const IconWrapper = styled.div`
|
||||
margin-bottom: 12px;
|
||||
cursor: default;
|
||||
`;
|
||||
|
||||
const Content = styled.div`
|
||||
@@ -96,12 +71,12 @@ const Name = styled.h3`
|
||||
${ellipsis()}
|
||||
`;
|
||||
|
||||
const Description = styled.p`
|
||||
margin: 4px 0 0;
|
||||
font-size: 14px;
|
||||
color: ${s("textTertiary")};
|
||||
${ellipsis()}
|
||||
`;
|
||||
// const Description = styled.p`
|
||||
// margin: 4px 0 0;
|
||||
// font-size: 14px;
|
||||
// color: ${s("textTertiary")};
|
||||
// ${ellipsis()}
|
||||
// `;
|
||||
|
||||
const Footer = styled.div`
|
||||
display: flex;
|
||||
@@ -116,7 +91,14 @@ const Status = styled.span<{ isActive: boolean }>`
|
||||
props.isActive ? props.theme.success : props.theme.danger};
|
||||
`;
|
||||
|
||||
const ActionButton = styled(Button)`
|
||||
const ActionLink = styled(Link)`
|
||||
display: inline-block;
|
||||
padding: 4px 8px;
|
||||
font-size: 14px;
|
||||
background: ${s("brand")};
|
||||
color: ${s("white")};
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
transition: background 150ms ease;
|
||||
`;
|
||||
@@ -27,7 +27,10 @@ function SettingsSidebar() {
|
||||
const { t } = useTranslation();
|
||||
const history = useHistory();
|
||||
const location = useLocation();
|
||||
const configs = useSettingsConfig();
|
||||
let configs = useSettingsConfig();
|
||||
configs = configs.filter((item) =>
|
||||
item.group === "Integrations" ? item.isActive : true
|
||||
);
|
||||
const groupedConfig = groupBy(configs, "group");
|
||||
|
||||
const returnToApp = React.useCallback(() => {
|
||||
|
||||
@@ -230,10 +230,7 @@ const useSettingsConfig = () => {
|
||||
return items;
|
||||
}, [t, can.createApiKey, can.update, can.createImport, can.createExport]);
|
||||
|
||||
return config.filter(
|
||||
(item) =>
|
||||
item.enabled && (item.group === "Integrations" ? item.isActive : true)
|
||||
);
|
||||
return config.filter((item) => item.enabled);
|
||||
};
|
||||
|
||||
export default useSettingsConfig;
|
||||
@@ -1,10 +1,67 @@
|
||||
import React from "react";
|
||||
// app/scenes/Settings/Integrations.tsx
|
||||
|
||||
import * as React from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
import Icon from "@shared/components/Icon";
|
||||
|
||||
import Heading from "~/components/Heading";
|
||||
|
||||
import IntegrationCard from "~/components/IntegrationCard";
|
||||
import Scene from "~/components/Scene";
|
||||
import Text from "~/components/Text";
|
||||
import useSettingsConfig from "~/hooks/useSettingsConfig";
|
||||
|
||||
export type ConfigItem = {
|
||||
name: string;
|
||||
path: string;
|
||||
icon: React.FC<React.ComponentProps<typeof Icon>>; // not used directly here
|
||||
component: React.ComponentType;
|
||||
enabled: boolean;
|
||||
group: string;
|
||||
isActive?: boolean;
|
||||
};
|
||||
|
||||
// six dummy integrations
|
||||
|
||||
export function Integrations() {
|
||||
const { t } = useTranslation();
|
||||
// const history = useHistory();
|
||||
let items = useSettingsConfig();
|
||||
items = items.filter((item) => item.group === "Integrations" && item.enabled);
|
||||
return (
|
||||
<div>
|
||||
<h1>Integrations</h1>
|
||||
<p>Integrations settings will be available here.</p>
|
||||
</div>
|
||||
<Scene title={t("Integrations")}>
|
||||
<Heading>{t("Integrations")}</Heading>
|
||||
<Text type="secondary">
|
||||
<Trans>
|
||||
Enable and configure third-party integrations to extend Outline’s
|
||||
functionality.
|
||||
</Trans>
|
||||
</Text>
|
||||
|
||||
<Grid>
|
||||
{items.map((item) => (
|
||||
<IntegrationCard
|
||||
key={item.path}
|
||||
integration={{
|
||||
id: item.path,
|
||||
name: item.name,
|
||||
icon: item.icon, // IntegrationCard will fallback to puzzle if unknown
|
||||
description: t("Connect your {{ name }} account", {
|
||||
name: item.name,
|
||||
}),
|
||||
isActive: !!item.isActive,
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</Grid>
|
||||
</Scene>
|
||||
);
|
||||
}
|
||||
|
||||
const Grid = styled.div`
|
||||
margin-top: 24px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill);
|
||||
gap: 20px;
|
||||
`;
|
||||
@@ -965,6 +965,8 @@
|
||||
"Enterprise": "Enterprise",
|
||||
"Quickly transfer your existing documents, pages, and files from other tools and services into {{appName}}. You can also drag and drop any HTML, Markdown, and text documents directly into Collections in the app.": "Quickly transfer your existing documents, pages, and files from other tools and services into {{appName}}. You can also drag and drop any HTML, Markdown, and text documents directly into Collections in the app.",
|
||||
"Recent imports": "Recent imports",
|
||||
"Enable and configure third-party integrations to extend Outline’s functionality.": "Enable and configure third-party integrations to extend Outline’s functionality.",
|
||||
"Connect your {{ name }} account": "Connect your {{ name }} account",
|
||||
"Could not load members": "Could not load members",
|
||||
"Everyone that has signed into {{appName}} is listed here. It’s possible that there are other users who have access through {{signinMethods}} but haven’t signed in yet.": "Everyone that has signed into {{appName}} is listed here. It’s possible that there are other users who have access through {{signinMethods}} but haven’t signed in yet.",
|
||||
"Receive a notification whenever a new document is published": "Receive a notification whenever a new document is published",
|
||||
|
||||
Reference in new issue
Block a user