Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
feat: user link now in tweet component (#89)
Browse files Browse the repository at this point in the history
* fix: router now replace instead of push

* feat: user-link now in tweet component
  • Loading branch information
CUexter authored Apr 12, 2023
1 parent e8193cd commit dddacfd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/layout/header/SearchUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const SearchUser = () => {
data={data}
onItemSubmit={(item) => {
const { id } = item as unknown as ItemProps;
void router.push("profile/" + id);
void router.replace("profile/" + id);
}}
filter={(value, item) => {
const i = item as unknown as ItemProps;
Expand Down
21 changes: 12 additions & 9 deletions src/components/tweets/Tweet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
IconHeart,
} from "@tabler/icons-react";
import Head from "next/head";
import Link from "next/link";

const useStyles = createStyles((theme) => ({
body: {
Expand Down Expand Up @@ -60,15 +61,17 @@ const Tweet = ({ tweetID, tweetData }: TweetProp) => {
</Head>
<div className="mx-auto">
<Card withBorder>
<Group>
<Avatar src={tweetData.user.image} color={"yellow"} radius="xl" />
<div>
<Text size="sm">{tweetData.user.display_name}</Text>
<Text size="xs" color="dimmed">
{tweetData.created_at.toString()}
</Text>
</div>
</Group>
<Link href={`/profile/${tweetData.user.id}`}>
<Group>
<Avatar src={tweetData.user.image} color={"yellow"} radius="xl" />
<div>
<Text size="sm">{tweetData.user.display_name}</Text>
<Text size="xs" color="dimmed">
{tweetData.created_at.toString()}
</Text>
</div>
</Group>
</Link>
<Text className={classes.body} size="sm">
{tweetData.TweetText[0]?.tweet_text}
</Text>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/auth/new-user.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const NewUserWelcome = () => {

useEffect(() => {
if (newUser || !session?.user) {
void router.push("/");
void router.replace("/");
}
}, [session, router, newUser]);

Expand Down Expand Up @@ -84,7 +84,7 @@ const NewUserWelcome = () => {
const onSubmit = (values: typeof form.values) => {
updateUser.mutate(values);
if (updateUser.isSuccess) {
void router.push("/");
void router.replace("/");
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/pages/following.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Following = () => {
const { data: session } = useSession();
useEffect(() => {
if (!session?.user) {
void router.push("/");
void router.replace("/");
}
}, [session, router]);
const following = ["uid1"];
Expand Down

1 comment on commit dddacfd

@vercel
Copy link

@vercel vercel bot commented on dddacfd Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

tweet – ./

tweet-git-main-cuexter.vercel.app
tweet-cuexter.vercel.app
tweet-rose.vercel.app

Please sign in to comment.