#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
import { useState, useEffect } from "react";
import { Group, Text } from "@mantine/core";
import { Button } from "@editor/ui/Button";
import { useTranslation } from "react-i18next";
import {
connectionModeService,
type ConnectionMode,
} from "@editor/services/connectionModeService";
import { OPEN_SIGN_IN_EVENT } from "@editor/constants/signInEvents";
/**
* Desktop-only footer shown at the bottom of the tool list.
* In local (offline) mode: prompts the user to sign in to unlock cloud tools.
* In other modes: renders nothing.
*/
export function ToolPickerFooterExtensions() {
const { t } = useTranslation();
const [connectionMode, setConnectionMode] = useState<ConnectionMode | null>(
null,
);
useEffect(() => {
void connectionModeService.getCurrentMode().then(setConnectionMode);
const unsubscribe = connectionModeService.subscribeToModeChanges(
(config) => {
setConnectionMode(config.mode);
},
);
return unsubscribe;
}, []);
if (connectionMode !== "local") return null;
return (
<Group
gap="xs"
align="center"
justify="space-between"
wrap="nowrap"
px="sm"
py={10}
style={{
borderTop: "1px solid var(--c-border)",
background: "var(--c-bg-raised)",
flexShrink: 0,
}}
>
<Text size="xs" c="dimmed" style={{ flex: 1, minWidth: 0 }}>
{t("localMode.toolPicker.message", "Sign in to unlock all tools.")}
</Text>
<Button
size="sm"
variant="secondary"
style={{ flexShrink: 0 }}
onClick={() =>
window.dispatchEvent(new CustomEvent(OPEN_SIGN_IN_EVENT))
}
>
{t("localMode.toolPicker.signIn", "Sign In")}
</Button>
</Group>
);
}