mirror of
https://github.com/outline/outline.git
synced 2026-12-06 11:12:32 +03:00
* React 19 upgrade Bumps react and react-dom to 19.2.8, with the dependency changes React 19 requires: react-is 19, @types/react 19, @types/react-dom 19, react-helmet-async 3 and react-avatar-editor 15 (which now ships its own types). framer-motion moves to 13 — its v6 types reference React.ReactHTML, removed from @types/react 19. The type changes fall into a few classes: - The global JSX namespace is gone, so JSX.Element becomes React.JSX.Element and the custom element declarations move into a module augmentation. - useRef() now requires an initial value. - A ref created with a null initial value is typed nullable, so consumers that accept one are widened to RefObject<T | null>. - React.ReactChild was removed; tooltips take React.ReactNode. - Ref callbacks may only return a cleanup function. react-dnd connectors return the connected node, so useDragRef and useDropRef wrap useDrag and useDrop and hand back a ref callback. react-i18next stays on v12: i18next 23 drops compatibilityJSON "v3", which would rewrite all 64 _plural keys across every locale. outline-icons, oy-vey and react-waypoint have no release that lists React 19 as a peer. All three render correctly under it; the install reports them as unmet peers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Remove react-helmet and forwardRef --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
85 lines
2.3 KiB
TypeScript
85 lines
2.3 KiB
TypeScript
import * as React from "react";
|
|
import { Trans } from "react-i18next";
|
|
import styled from "styled-components";
|
|
import { Backticks } from "@shared/components/Backticks";
|
|
import { PullRequestIcon } from "@shared/components/PullRequestIcon";
|
|
import { richExtensions } from "@shared/editor/nodes";
|
|
import type { UnfurlResourceType, UnfurlResponse } from "@shared/types";
|
|
import { Avatar } from "~/components/Avatar";
|
|
import Editor from "~/components/Editor";
|
|
import Flex from "~/components/Flex";
|
|
import Text from "../Text";
|
|
import Time from "../Time";
|
|
import {
|
|
Preview,
|
|
Title,
|
|
Description,
|
|
Card,
|
|
CardContent,
|
|
Info,
|
|
} from "./Components";
|
|
|
|
type Props = Omit<UnfurlResponse[UnfurlResourceType.PR], "type"> & {
|
|
ref?: React.Ref<HTMLDivElement>;
|
|
};
|
|
|
|
function HoverPreviewPullRequest({
|
|
url,
|
|
title,
|
|
id,
|
|
description,
|
|
author,
|
|
state,
|
|
createdAt,
|
|
ref,
|
|
}: Props) {
|
|
const authorName = author.name;
|
|
|
|
return (
|
|
<Preview as="a" href={url} target="_blank" rel="noopener noreferrer">
|
|
<Flex column ref={ref}>
|
|
<Card fadeOut={false}>
|
|
<CardContent>
|
|
<Flex gap={2} column>
|
|
<Title>
|
|
<StyledPullRequestIcon size={18} state={state} />
|
|
<span>
|
|
<Backticks content={title} />
|
|
<Text type="tertiary">{id}</Text>
|
|
</span>
|
|
</Title>
|
|
<Flex align="center" gap={6}>
|
|
<Avatar src={author.avatarUrl} size={18} />
|
|
<Info>
|
|
<Trans>
|
|
{{ authorName }} opened{" "}
|
|
<Time dateTime={createdAt} addSuffix />
|
|
</Trans>
|
|
</Info>
|
|
</Flex>
|
|
{description && (
|
|
<Description as="div">
|
|
<React.Suspense fallback={<div />}>
|
|
<Editor
|
|
extensions={richExtensions}
|
|
defaultValue={description}
|
|
embedsDisabled
|
|
readOnly
|
|
/>
|
|
</React.Suspense>
|
|
</Description>
|
|
)}
|
|
</Flex>
|
|
</CardContent>
|
|
</Card>
|
|
</Flex>
|
|
</Preview>
|
|
);
|
|
}
|
|
|
|
const StyledPullRequestIcon = styled(PullRequestIcon)`
|
|
margin-top: 2px;
|
|
`;
|
|
|
|
export default HoverPreviewPullRequest;
|