Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

U3 dev #125

Merged
merged 35 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e43208a
init notifications
sin-bufan Sep 19, 2023
ba7b377
feat: profile farcaster
Sep 21, 2023
6a723d8
Merge pull request #117 from us3r-network/F-profileFcastInfo-ttang
Tonyce Sep 21, 2023
fff6f81
add motifications
sin-bufan Sep 22, 2023
034998a
add motifications
sin-bufan Sep 22, 2023
6fb3718
Merge branch 'u3-dev' into F-notifications-bufan
sin-bufan Sep 22, 2023
80e1950
feat: profile following and followers
friendlysxw Sep 22, 2023
a1281c9
Merge branch 'u3-dev' into F-profileFollowingAndFollowers-shixuewen
friendlysxw Sep 22, 2023
2f0fad7
fix: first account using lens
friendlysxw Sep 22, 2023
c3202f2
fix: follow profile card status
friendlysxw Sep 22, 2023
093a5db
fix: ProfileFollowData to FollowProfileData
friendlysxw Sep 22, 2023
00175ac
Merge pull request #118 from us3r-network/F-profileFollowingAndFollow…
friendlysxw Sep 22, 2023
4d0295a
add unread count and rewirte footnavs
sin-bufan Sep 22, 2023
f27d88e
fix: follow list data compatibility
friendlysxw Sep 25, 2023
4c859a8
Merge pull request #120 from us3r-network/B-fixFollowingAndFollowers-…
sin-bufan Sep 25, 2023
463366d
Merge branch 'u3-dev' into F-notifications-bufan
sin-bufan Sep 25, 2023
cff8f21
fix conflict
sin-bufan Sep 25, 2023
ad6d9b0
Merge pull request #119 from us3r-network/F-notifications-bufan
friendlysxw Sep 25, 2023
5d443ae
fix: The target attribute of lens's markdown link uses _blank
friendlysxw Sep 25, 2023
a8e01bb
Merge pull request #121 from us3r-network/B-lensMarkdownLinkTargetBla…
sin-bufan Sep 25, 2023
80b65d8
update ui detail and fix some issues
sin-bufan Sep 25, 2023
5bb3e93
Merge pull request #122 from us3r-network/F-notifications-bufan
friendlysxw Sep 25, 2023
4604d9f
fix: socialLayout keepAlive
friendlysxw Sep 25, 2023
5087720
Merge pull request #123 from us3r-network/B-socialLayoutKeepAlive-shi…
sin-bufan Sep 25, 2023
478b92b
fix post text style
sin-bufan Sep 25, 2023
2068ef9
Merge pull request #124 from us3r-network/F-notifications-bufan
sin-bufan Sep 26, 2023
e8d86fb
feat: pageSize 30 & scrollThreshold 1000px
friendlysxw Sep 26, 2023
0c2d7b0
Merge pull request #126 from us3r-network/F-pageSize30AndScrollThresh…
sin-bufan Sep 26, 2023
b223aef
feat: farcaster follow
Sep 26, 2023
e5839b8
Merge pull request #127 from us3r-network/F-fcasterFollowList-ttang
sin-bufan Sep 26, 2023
1f81791
fix: lens publication permission
friendlysxw Sep 26, 2023
52ad7c2
fix notification text issue
sin-bufan Sep 26, 2023
783ab84
Merge pull request #128 from us3r-network/B-lensPublicationActionPerm…
sin-bufan Sep 26, 2023
dd9a50b
Merge pull request #130 from us3r-network/F-notifications-bufan
sin-bufan Sep 26, 2023
01aa92a
add did-session resolutions
sin-bufan Sep 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions apps/u3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,10 @@
"swiper": "^8.2.4",
"three": "^0.147.0",
"tslib": "^2.3.0",
"typescript": "^4.9.5",
"viem": "^0.3.37",
"wagmi": "^1.0.7",
"web-vitals": "^2.1.4",
"yup": "^0.32.11",
"typescript": "^4.9.5",
"workbox-background-sync": "^6.6.0",
"workbox-broadcast-update": "^6.6.0",
"workbox-cacheable-response": "^6.6.0",
Expand All @@ -88,7 +87,8 @@
"workbox-range-requests": "^6.6.0",
"workbox-routing": "^6.6.0",
"workbox-strategies": "^6.6.0",
"workbox-streams": "^6.6.0"
"workbox-streams": "^6.6.0",
"yup": "^0.32.11"
},
"scripts": {
"start": "craco start",
Expand All @@ -109,15 +109,15 @@
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/hammerjs": "^2.0.41",
"@types/mockjs": "^1.0.6",
"@types/react-is": "17.0.3",
"@types/react-lottie": "^1.2.6",
"@types/lodash": "^4.14.191",
"@types/pubsub-js": "^1.8.3",
"@types/jest": "^27.5.2",
"@types/lodash": "^4.14.191",
"@types/mockjs": "^1.0.6",
"@types/node": "^17.0.45",
"@types/pubsub-js": "^1.8.3",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react-is": "17.0.3",
"@types/react-lottie": "^1.2.6",
"@types/react-modal": "^3.13.1",
"@types/react-router-dom": "5.3.3",
"@types/react-slick": "^0.23.10",
Expand Down Expand Up @@ -158,5 +158,8 @@
"url": "^0.11.0",
"webpack": "^5.73.0",
"webpack-bundle-analyzer": "^4.6.0"
},
"resolutions": {
"did-session": "2.0.1"
}
}
5 changes: 4 additions & 1 deletion apps/u3/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import U3LoginProvider from './contexts/U3LoginContext';
import { XmtpClientProvider } from './contexts/xmtp/XmtpClientCtx';
import { XmtpStoreProvider } from './contexts/xmtp/XmtpStoreCtx';
import { AppLensProvider } from './contexts/AppLensCtx';
import { NavProvider } from './contexts/NavCtx';
import FarcasterProvider from './contexts/FarcasterCtx';

init(AIRSTACK_API_KEY);
Expand Down Expand Up @@ -60,7 +61,9 @@ function App() {
<GlobalStyle />
<BrowserRouter>
<AliveScope>
<Layout />
<NavProvider>
<Layout />
</NavProvider>
</AliveScope>
</BrowserRouter>
</ReduxProvider>
Expand Down
140 changes: 129 additions & 11 deletions apps/u3/src/api/farcaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ import { REACT_APP_API_SOCIAL_URL } from '../constants';

// console.log({ REACT_APP_API_SOCIAL_URL });

export type FarcasterNotification = {
message_fid: number;
message_type: number;
message_timestamp: string;
message_hash: Buffer;
reaction_type?: number;
id?: string;
hash?: Buffer;
text?: string;
userData: unknown;
};

export type FarcasterPageInfo = {
endFarcasterCursor: string;
hasNextPage: boolean;
};

export type FarcasterUserData = {
fid: string;
type: number;
value: string;
};

export function getFarcasterFeeds({
endFarcasterCursor,
pageSize,
Expand All @@ -13,11 +36,8 @@ export function getFarcasterFeeds({
}): AxiosPromise<
ApiResp<{
data: { data: FarCast; platform: 'farcaster' }[];
farcasterUserData: { fid: string; type: number; value: string }[];
pageInfo: {
endFarcasterCursor: string;
hasNextPage: boolean;
};
farcasterUserData: FarcasterUserData[];
pageInfo: FarcasterPageInfo;
}>
> {
return axios({
Expand All @@ -32,7 +52,7 @@ export function getFarcasterFeeds({

export function getFarcasterUserInfo(
fids: number[]
): AxiosPromise<ApiResp<{ type: number; value: string }[]>> {
): AxiosPromise<ApiResp<FarcasterUserData[]>> {
return axios({
url: `${REACT_APP_API_SOCIAL_URL}/3r/farcaster/userinfo`,
method: 'get',
Expand All @@ -55,11 +75,8 @@ export function getFarcasterCastInfo(
ApiResp<{
cast: FarCast;
comments: { data: FarCast; platform: 'farcaster' }[];
farcasterUserData: { fid: string; type: number; value: string }[];
pageInfo: {
endFarcasterCursor: string;
hasNextPage: boolean;
};
farcasterUserData: FarcasterUserData[];
pageInfo: FarcasterPageInfo;
}>
> {
return axios({
Expand Down Expand Up @@ -98,3 +115,104 @@ export function getFarcasterEmbedMetadata(urls: string[]): AxiosPromise<
},
});
}

export function getFarcasterNotifications({
fid,
endFarcasterCursor,
pageSize,
}: {
fid: number;
endFarcasterCursor?: string;
pageSize?: number;
}): AxiosPromise<
ApiResp<{
notifications: FarcasterNotification[];
farcasterUserData: FarcasterUserData[];
pageInfo: FarcasterPageInfo;
}>
> {
return axios({
url: `${REACT_APP_API_SOCIAL_URL}/3r/farcaster/notifications`,
method: 'get',
params: {
fid,
pageSize,
next: endFarcasterCursor,
withInfo: true,
},
});
}

export function getFarcasterUnreadNotificationCount({
fid,
}: {
fid: number;
}): AxiosPromise<
ApiResp<{
count: number;
lastTime: string | null;
}>
> {
return axios({
url: `${REACT_APP_API_SOCIAL_URL}/3r/farcaster/notifications/unreadCount`,
method: 'get',
params: {
fid,
},
});
}

export function clearFarcasterUnreadNotification({
fid,
}: {
fid: number;
}): AxiosPromise<
ApiResp<{
lastTime: string;
}>
> {
return axios({
url: `${REACT_APP_API_SOCIAL_URL}/3r/farcaster/notifications/clearUnread`,
method: 'post',
data: {
fid,
},
});
}

export function getFarcasterFollow(fid: string | number): AxiosPromise<
ApiResp<{
followers: number;
following: number;
}>
> {
return axios({
url: `${REACT_APP_API_SOCIAL_URL}/3r/farcaster/follow`,
method: 'get',
params: {
fid,
},
});
}

export function getFarcasterLinks(
fid: string | number,
withInfo = false
): AxiosPromise<
ApiResp<{
followerCount: number;
followingCount: number;
followerData: string[];
followingData: string[];
farcasterUserData: { fid: string; type: number; value: string }[];
}>
> {
return axios({
url: `${REACT_APP_API_SOCIAL_URL}/3r/farcaster/links`,
method: 'get',
params: {
fid,
withInfo,
},
});
}
10 changes: 6 additions & 4 deletions apps/u3/src/api/feeds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export enum ProfileFeedsGroups {
REPLIES = 'replies',
}

export const FEEDS_PAGE_SIZE = 30;

export function getFeeds({
pageSize,
keyword,
Expand All @@ -70,7 +72,7 @@ export function getFeeds({
url: `${REACT_APP_API_SOCIAL_URL}/3r/feeds`,
method: 'get',
params: {
pageSize,
pageSize: pageSize || FEEDS_PAGE_SIZE,
keyword,
endFarcasterCursor,
endLensCursor,
Expand Down Expand Up @@ -109,7 +111,7 @@ export function getFollowingFeeds({
url: `${REACT_APP_API_SOCIAL_URL}/3r/followingFeeds`,
method: 'get',
params: {
pageSize,
pageSize: pageSize || FEEDS_PAGE_SIZE,
keyword,
endFarcasterCursor,
endLensCursor,
Expand Down Expand Up @@ -146,7 +148,7 @@ export function getTrendingFeeds({
url: `${REACT_APP_API_SOCIAL_URL}/3r/trendingFeeds`,
method: 'get',
params: {
pageSize,
pageSize: pageSize || FEEDS_PAGE_SIZE,
keyword,
endFarcasterCursor,
endLensCursor,
Expand Down Expand Up @@ -187,7 +189,7 @@ export function getProfileFeeds({
url: `${REACT_APP_API_SOCIAL_URL}/3r/profileFeeds`,
method: 'get',
params: {
pageSize,
pageSize: pageSize || FEEDS_PAGE_SIZE,
keyword,
group,
endFarcasterCursor,
Expand Down
36 changes: 25 additions & 11 deletions apps/u3/src/components/common/mobile/MobilePageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,43 @@
* @LastEditTime: 2023-03-02 09:39:48
* @Description: file description
*/
import { useEffect, useState } from 'react';
import styled from 'styled-components';

export default function MobilePageHeader({
tabs,
curTab,
setTab,
options,
}: {
tabs: string[];
tabs?: string[];
curTab: string;
setTab: React.Dispatch<React.SetStateAction<string>>;
options?: Array<{ value: any; label: string }>;
}) {
return (
<PageHeader tab={curTab}>
{tabs?.map((key) => (
<div
key={key}
className={curTab === key ? 'tab active' : 'tab'}
onClick={() => setTab(key)}
>
{key}
</div>
))}
{(() => {
if (options) {
return options?.map((option) => (
<div
key={option.value}
className={curTab === option.value ? 'tab active' : 'tab'}
onClick={() => setTab(option.value)}
>
{option.label}
</div>
));
}
return tabs?.map((key) => (
<div
key={key}
className={curTab === key ? 'tab active' : 'tab'}
onClick={() => setTab(key)}
>
{key}
</div>
));
})()}
</PageHeader>
);
}
Expand Down
Loading