Skip to content

Commit

Permalink
Merge branch 'preview'
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelfan committed Jan 19, 2024
2 parents 51e6550 + 2531b9d commit 35d3409
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 32 deletions.
6 changes: 2 additions & 4 deletions src/components/actions/composeButton/ComposeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ export default function ComposeButton(props: Props) {
: "";
const { openComposer } = useComposerControls();

const canUpdate = typeof window !== "undefined";

return (
<>
{mode === "float" && (
<button
onClick={() => openComposer({ mention: userHandle })}
className="z-40 p-3.5 rounded-full fixed md:hidden right-3 bottom-24 bg-primary text-white hover:bg-primary-dark outline-none ease-linear transition-all"
style={{
opacity: canUpdate ? `${100 - (val ?? 0)}%` : "none",
transform: canUpdate ? `translateY(${val ?? 0}%)` : "none",
opacity: val ? `${100 - (val ?? 0)}%` : "100%",
transform: val ? `translateY(${val ?? 0}%)` : "100%",
}}
>
<RiQuillPenFill className="text-2xl" />
Expand Down
6 changes: 2 additions & 4 deletions src/components/actions/refetch/Refetch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ export default function Refetch(props: Props) {
const val = useScrollContext();
const debouncedRefetch = useDebouncedCallback(onRefetch, 300);

const canUpdate = typeof window !== "undefined";

return (
<Button
onClick={debouncedRefetch}
className="z-40 p-3 rounded-full fixed bottom-24 md:bottom-8 ml-3 md:ml-[0.80rem] border border-neutral-300 bg-white hover:bg-neutral-50 hover:-rotate-180 ease-linear transition-all"
style={{
opacity: canUpdate ? `${100 - (val ?? 0)}%` : "none",
transform: canUpdate ? `translateY(${val ?? 0}%)` : "none",
opacity: val ? `${100 - (val ?? 0)}%` : "100%",
transform: val ? `translateY(${val ?? 0}%)` : "100%",
}}
>
<LuRefreshCcw className="text-2xl text-neutral-500 hover:text-neutral-600" />
Expand Down
6 changes: 2 additions & 4 deletions src/components/navigational/appBar/AppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ export default function AppBar() {
refetchInterval: 10000,
});

const canUpdate = typeof window !== "undefined";

return (
<nav
className="flex justify-between pb-8 pt-1 px-6 border-t gap-6 fixed bottom-0 z-40 w-full md:hidden bg-white overflow-auto ease-linear transition-all"
style={{
opacity: canUpdate ? `${100 - (val ?? 0)}%` : "none",
transform: canUpdate ? `translateY(${val ?? 0}%)` : "none",
opacity: val ? `${100 - (val ?? 0)}%` : "100%",
transform: val ? `translateY(${val ?? 0}%)` : "100%",
}}
>
<NavItem
Expand Down
6 changes: 2 additions & 4 deletions src/components/navigational/feedTabs/FeedTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ export default function FeedTabs() {
queryFn: () => getSavedFeeds(agent),
});

const canUpdate = typeof window !== "undefined" && window.innerWidth < 768;

return (
<>
<div className="z-40 hidden md:block fixed bg-white top-0 lg:p-5 md:p-5 max-w-xl w-full" />
<div
className={`bg-white border-x-0 border-t-0 border-b md:border md:rounded-t-2xl overflow-x-hidden hover:overflow-x-auto md:opacity-100 sticky top-[3.2rem] md:top-6 z-50 md:z-50 ease-linear transition-all`}
style={{
opacity: canUpdate ? `${100 - (val ?? 0)}%` : "none",
transform: canUpdate ? `translateY(-${val ?? 0}%)` : "none",
opacity: val ? `${100 - (val ?? 0)}%` : "100%",
transform: val ? `translateY(-${val ?? 0}%)` : "100%",
}}
>
{isFetching && <FeedTabsSkeleton />}
Expand Down
6 changes: 2 additions & 4 deletions src/components/navigational/topBar/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ export default function TopBar(props: Props) {
const { profile } = props;
const val = useScrollContext();

const canUpdate = typeof window !== "undefined" && window.innerWidth < 768;

return (
<div
className="flex justify-between bg-white border-b px-3 py-2.5 sticky md:hidden top-0 z-50 ease-linear transition-all"
style={{
opacity: canUpdate ? `${100 - (val ?? 0)}%` : "none",
transform: canUpdate ? `translateY(-${val ?? 0}%)` : "none",
opacity: val ? `${100 - (val ?? 0)}%` : "100%",
transform: val ? `translateY(-${val ?? 0}%)` : "100%",
}}
>
<Link
Expand Down
2 changes: 1 addition & 1 deletion src/containers/FollowersContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface Props {
export default function FollowersContainer(props: Props) {
const { handle } = props;
const agent = useAgent();
const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "100px" });

const {
status,
Expand Down
2 changes: 1 addition & 1 deletion src/containers/FollowingContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface Props {
export default function FollowingContainer(props: Props) {
const { handle } = props;
const agent = useAgent();
const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "100px" });

const {
status,
Expand Down
2 changes: 1 addition & 1 deletion src/containers/search/PostSearchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function PostSearchContainer(props: Props) {
const isEmpty =
!isFetching && !isFetchingNextPage && posts?.pages[0]?.posts?.length === 0;

const { ref: observerRef, inView } = useInView();
const { ref: observerRef, inView } = useInView({ rootMargin: "800px" });

useEffect(() => {
if (inView) {
Expand Down
2 changes: 1 addition & 1 deletion src/containers/search/UserSearchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface Props {
export default function UserSearchContainer(props: Props) {
const { query } = props;
const agent = useAgent();
const { ref: observerRef, inView } = useInView();
const { ref: observerRef, inView } = useInView({ rootMargin: "100px" });

const {
status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import LoadingSpinner from "@/components/status/loadingSpinner/LoadingSpinner";

export default function BlockedUsersContainer() {
const agent = useAgent();
const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "100px" });

const {
status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import LoadingSpinner from "@/components/status/loadingSpinner/LoadingSpinner";

export default function MutedUsersContainer() {
const agent = useAgent();
const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "100px" });

const {
status,
Expand Down
2 changes: 1 addition & 1 deletion src/containers/thread/LikedByContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function LikedByContainer(props: Props) {
const { handle, id } = props;

const agent = useAgent();
const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "100px" });

const {
status,
Expand Down
2 changes: 1 addition & 1 deletion src/containers/thread/RepostedByContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function RepostedByContainer(props: Props) {
const { handle, id } = props;

const agent = useAgent();
const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "100px" });

const {
status,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/hooks/bsky/feed/useFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const useFeedKey = (feed: string) => [feed];

export default function useFeed(feed: string) {
const agent = useAgent();
const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "800px" });
const {
status,
data: timeline,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/hooks/bsky/feed/useProfilePosts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function useProfilePosts(props: Props) {
}
};

const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "100px" });
const {
status,
data: userPosts,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/hooks/bsky/notification/useNotification.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useInView } from "react-intersection-observer";
import useAgent from "../useAgent";
import { useInfiniteQuery } from "@tanstack/react-query";
import { useEffect, useMemo } from "react";
import { useEffect } from "react";
import {
getNotifications,
updateSeenNotifications,
Expand All @@ -11,7 +11,7 @@ import { Notification } from "@atproto/api/dist/client/types/app/bsky/notificati

export default function useNotification() {
const agent = useAgent();
const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "100px" });

const groupNotifications = (
notifications: Notification[]
Expand Down

0 comments on commit 35d3409

Please sign in to comment.