Merge remote-tracking branch 'origin/next' into next-colors

This commit is contained in:
Alex Gleason 2022-03-23 13:05:53 -05:00
commit 12617bf7de
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
70 changed files with 83 additions and 43 deletions

View file

@ -9,33 +9,6 @@
<link href="/manifest.json" rel="manifest">
<!--server-generated-meta-->
<link rel="icon" type="image/png" href="/favicon.png">
<link href='/icons/icon-57x57.png' rel='apple-touch-icon' sizes='57x57'>
<link href='/icons/icon-64x64.png' rel='apple-touch-icon' sizes='64x64'>
<link href='/icons/icon-72x72.png' rel='apple-touch-icon' sizes='72x72'>
<link href='/icons/icon-114x114.png' rel='apple-touch-icon' sizes='114x114'>
<link href='/icons/icon-120x120.png' rel='apple-touch-icon' sizes='120x120'>
<link href='/icons/icon-180x180.png' rel='apple-touch-icon' sizes='180x180'>
<link href='/icons/icon-192x192.png' rel='apple-touch-icon' sizes='192x192'>
<link href='/icons/icon-512x512.png' rel='apple-touch-icon' sizes='512x512'>
<script>
if(window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.didBeginLoadingSoapbox) {
window.webkit.messageHandlers.didBeginLoadingSoapbox.postMessage("started");
}
</script>
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//trk.bonsa.net/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '23231245']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
</head>
<body class="theme-mode-light no-reduce-motion">
<div id="soapbox">

View file

@ -4,7 +4,7 @@ import { Link } from 'react-router-dom';
import HoverRefWrapper from 'soapbox/components/hover_ref_wrapper';
import VerificationBadge from 'soapbox/components/verification_badge';
import ActionButton from 'soapbox/features/ui/components/action_button';
import { useAppSelector } from 'soapbox/hooks';
import { useAppSelector, useOnScreen } from 'soapbox/hooks';
import { getAcct } from 'soapbox/utils/accounts';
import { displayFqn } from 'soapbox/utils/state';
@ -52,8 +52,9 @@ const Account = ({
timestampUrl,
withRelationship = true,
}: IAccount) => {
const overflowRef = React.useRef(null);
const actionRef = React.useRef(null);
const overflowRef = React.useRef<HTMLDivElement>(null);
const actionRef = React.useRef<HTMLDivElement>(null);
const isOnScreen = useOnScreen(overflowRef);
const [style, setStyle] = React.useState<React.CSSProperties>({ visibility: 'hidden' });
@ -93,18 +94,19 @@ const Account = ({
};
React.useEffect(() => {
const style: React.CSSProperties = {};
if (isOnScreen) {
const style: React.CSSProperties = {};
const actionWidth = actionRef.current?.clientWidth;
const actionWidth = actionRef.current?.clientWidth;
if (overflowRef.current) {
style.maxWidth = overflowRef.current.clientWidth - 30 - avatarSize - actionWidth;
} else {
style.visibility = 'hidden';
}
if (overflowRef.current) {
style.maxWidth = overflowRef.current.clientWidth - 30 - avatarSize - actionWidth;
} else {
style.visibility = 'hidden';
setStyle(style);
}
setStyle(style);
}, [overflowRef, actionRef]);
}, [isOnScreen, overflowRef, actionRef]);
if (!account) {
return null;
@ -161,8 +163,8 @@ const Account = ({
</LinkEl>
</ProfilePopper>
<HStack alignItems='center' space={1}>
<Text theme='muted' size='sm'>@{username}</Text>
<HStack alignItems='center' space={1} style={style}>
<Text theme='muted' size='sm' truncate>@{username}</Text>
{(timestamp) ? (
<>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,37 @@
import * as React from 'react';
import { useHistory } from 'react-router-dom';
interface IPermaLink extends Pick<React.HTMLAttributes<HTMLAnchorElement>, 'dangerouslySetInnerHTML'> {
className?: string,
href: string,
title?: string,
to: string,
}
const Permalink: React.FC<IPermaLink> = (props) => {
const history = useHistory();
const { className, href, title, to, children, ...filteredProps } = props;
const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
if (event.button === 0 && !(event.ctrlKey || event.metaKey)) {
event.preventDefault();
history.push(to);
}
};
return (
<a
target='_blank'
href={href}
onClick={handleClick}
title={title}
className={`permalink${className ? ' ' + className : ''}`}
{...filteredProps}
>
{children}
</a>
);
};
export default Permalink;

Binary file not shown.

View file

@ -29,6 +29,7 @@ interface IHStack {
justifyContent?: 'between' | 'center',
space?: 0.5 | 1 | 1.5 | 2 | 3 | 4 | 6,
grow?: boolean,
style?: React.CSSProperties
}
const HStack: React.FC<IHStack> = (props) => {

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -116,7 +116,7 @@ const ProfileDropdown: React.FC<IProfileDropdown> = ({ account, children }) => {
const itemProps = menuItem.action ? { onSelect: menuItem.action } : { to: menuItem.to, as: Link };
return (
<Comp key={idx} {...itemProps}>
<Comp key={idx} {...itemProps} className='truncate'>
{menuItem.text}
</Comp>
);

View file

@ -1 +1,2 @@
export { useAppSelector } from './useAppSelector';
export { useOnScreen } from './useOnScreen';

View file

@ -0,0 +1,19 @@
import * as React from 'react';
export const useOnScreen = (ref: React.MutableRefObject<HTMLElement>) => {
const [isIntersecting, setIntersecting] = React.useState(false);
const observer = new IntersectionObserver(
([entry]) => setIntersecting(entry.isIntersecting),
);
React.useEffect(() => {
observer.observe(ref.current);
return () => {
observer.disconnect();
};
}, []);
return isIntersecting;
};

Binary file not shown.

Binary file not shown.

View file

@ -40,7 +40,7 @@
}
.notification-bar-wrapper {
@apply p-4 flex items-start;
@apply p-4 flex items-center justify-between w-full space-x-2;
}
.notification-bar-title {
@ -50,3 +50,10 @@
.notification-bar-message {
@apply text-sm text-gray-700;
}
.notification-bar-action a {
@apply inline-flex items-center px-2.5 py-1 border border-solid border-gray-300
shadow-sm text-xs font-medium rounded-full text-gray-700 bg-white
hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2
focus:ring-primary-500;
}