mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-14 04:08:32 +03:00
Move notifications link from Following to Home
This commit is contained in:
parent
f198571367
commit
d324d3a672
2 changed files with 24 additions and 20 deletions
|
@ -1,8 +1,6 @@
|
|||
import { useEffect, useRef } from 'preact/hooks';
|
||||
import { useSnapshot } from 'valtio';
|
||||
|
||||
import Icon from '../components/icon';
|
||||
import Link from '../components/link';
|
||||
import Timeline from '../components/timeline';
|
||||
import { api } from '../utils/api';
|
||||
import states from '../utils/states';
|
||||
|
@ -11,7 +9,7 @@ import useTitle from '../utils/useTitle';
|
|||
|
||||
const LIMIT = 20;
|
||||
|
||||
function Following({ title, path, id, headerStart }) {
|
||||
function Following({ title, path, id, ...props }) {
|
||||
useTitle(title || 'Following', path, '/l/f');
|
||||
const { masto, instance } = api();
|
||||
const snapStates = useSnapshot(states);
|
||||
|
@ -109,20 +107,6 @@ function Following({ title, path, id, headerStart }) {
|
|||
};
|
||||
}, []);
|
||||
|
||||
const headerEnd = (
|
||||
<Link
|
||||
to="/notifications"
|
||||
class={`button plain ${
|
||||
snapStates.notificationsShowNew ? 'has-badge' : ''
|
||||
}`}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<Icon icon="notification" size="l" alt="Notifications" />
|
||||
</Link>
|
||||
);
|
||||
|
||||
return (
|
||||
<Timeline
|
||||
title={title || 'Following'}
|
||||
|
@ -132,9 +116,8 @@ function Following({ title, path, id, headerStart }) {
|
|||
fetchItems={fetchHome}
|
||||
checkForUpdates={checkForUpdates}
|
||||
useItemID
|
||||
headerStart={headerStart}
|
||||
headerEnd={headerEnd}
|
||||
boostsCarousel={snapStates.settings.boostsCarousel}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { useEffect } from 'preact/hooks';
|
||||
import { useSnapshot } from 'valtio';
|
||||
|
||||
import Icon from '../components/icon';
|
||||
import Link from '../components/link';
|
||||
import db from '../utils/db';
|
||||
import openCompose from '../utils/open-compose';
|
||||
import states from '../utils/states';
|
||||
|
@ -9,6 +11,7 @@ import { getCurrentAccountNS } from '../utils/store-utils';
|
|||
import Following from './following';
|
||||
|
||||
function Home() {
|
||||
const snapStates = useSnapshot(states);
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const keys = await db.drafts.keys();
|
||||
|
@ -24,7 +27,25 @@ function Home() {
|
|||
|
||||
return (
|
||||
<>
|
||||
<Following title="Home" path="/" id="home" headerStart={false} />
|
||||
<Following
|
||||
title="Home"
|
||||
path="/"
|
||||
id="home"
|
||||
headerStart={false}
|
||||
headerEnd={
|
||||
<Link
|
||||
to="/notifications"
|
||||
class={`button plain ${
|
||||
snapStates.notificationsShowNew ? 'has-badge' : ''
|
||||
}`}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<Icon icon="notification" size="l" alt="Notifications" />
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
<button
|
||||
// hidden={scrollDirection === 'end' && !nearReachStart}
|
||||
type="button"
|
||||
|
|
Loading…
Add table
Reference in a new issue