mirror of
https://github.com/usatiuk/y.git
synced 2025-10-28 10:37:47 +01:00
a little cleanup
This commit is contained in:
@@ -38,6 +38,17 @@
|
||||
cursor: pointer;
|
||||
color: inherit;
|
||||
font-size: 0.8rem;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
span {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
font-size: 0.8rem;
|
||||
font-family: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ export function ProfileCard({
|
||||
actions,
|
||||
alreadyFollowing,
|
||||
isAdmin,
|
||||
isFollower,
|
||||
}: {
|
||||
username: string;
|
||||
fullName: string;
|
||||
@@ -16,6 +17,7 @@ export function ProfileCard({
|
||||
actions: boolean;
|
||||
alreadyFollowing: boolean;
|
||||
isAdmin: boolean;
|
||||
isFollower: boolean;
|
||||
}) {
|
||||
const homeContext = useHomeContext();
|
||||
|
||||
@@ -85,6 +87,7 @@ export function ProfileCard({
|
||||
</button>
|
||||
</Form>
|
||||
))}
|
||||
{isFollower && <span>follows you</span>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -14,8 +14,8 @@ export function UserList() {
|
||||
return <div>Error</div>;
|
||||
}
|
||||
|
||||
const { people, following } = loaderData;
|
||||
if (isError(following) || isError(people)) {
|
||||
const { people, following, followers } = loaderData;
|
||||
if (isError(following) || isError(people) || isError(followers)) {
|
||||
return <div>Error</div>;
|
||||
}
|
||||
return (
|
||||
@@ -32,6 +32,7 @@ export function UserList() {
|
||||
alreadyFollowing={following.some(
|
||||
(f) => f.uuid == u.uuid,
|
||||
)}
|
||||
isFollower={followers.some((f) => f.uuid == u.uuid)}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -56,6 +56,10 @@ export async function getFollowing(): Promise<TPersonToArrResp> {
|
||||
return fetchJSONAuth("/person/following", "GET", PersonToArrResp);
|
||||
}
|
||||
|
||||
export async function getFollowers(): Promise<TPersonToArrResp> {
|
||||
return fetchJSONAuth("/person/followers", "GET", PersonToArrResp);
|
||||
}
|
||||
|
||||
export async function getPersonByUsername(
|
||||
username: string,
|
||||
): Promise<TPersonToResp> {
|
||||
|
||||
@@ -31,7 +31,7 @@ export async function getPostsByAuthorUuid(
|
||||
author: string,
|
||||
): Promise<TPostToArrResp> {
|
||||
return fetchJSONAuth(
|
||||
`/post/by-author-uuid?author=${author}`,
|
||||
`/post/by-author-uuid/${author}`,
|
||||
"GET",
|
||||
PostToArrResp,
|
||||
);
|
||||
@@ -45,7 +45,7 @@ export async function getPostsByAuthorUsername(
|
||||
author: string,
|
||||
): Promise<TPostToArrResp> {
|
||||
return fetchJSONAuth(
|
||||
`/post/by-author-username?author=${author}`,
|
||||
`/post/by-author-username/${author}`,
|
||||
"GET",
|
||||
PostToArrResp,
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
getAllPerson,
|
||||
getFollowers,
|
||||
getFollowing,
|
||||
getPersonByUsername,
|
||||
getSelf,
|
||||
@@ -36,7 +37,11 @@ export async function homeLoader() {
|
||||
}
|
||||
|
||||
export async function userListLoader() {
|
||||
return { people: await getAllPerson(), following: await getFollowing() };
|
||||
return {
|
||||
people: await getAllPerson(),
|
||||
following: await getFollowing(),
|
||||
followers: await getFollowers(),
|
||||
};
|
||||
}
|
||||
|
||||
export async function profileLoader({
|
||||
|
||||
Reference in New Issue
Block a user