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

chore: grab most upstream changes #11

Merged
merged 56 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
6a233b9
Merge pull request #407 from xmtp-labs/dev
daria-github Nov 20, 2023
1bed2ef
Merge pull request #409 from xmtp-labs/dev
daria-github Nov 22, 2023
3d60706
Merge pull request #415 from xmtp-labs/dev
daria-github Jan 3, 2024
3692fb9
Merge pull request #417 from xmtp-labs/dev
daria-github Jan 9, 2024
4733d77
add portable consent
Jan 12, 2024
aad2bae
updated initial sort
Jan 12, 2024
e29fe0c
updated dependencies
Jan 13, 2024
49803b2
fixed type
Jan 13, 2024
f867ef3
memoized messages to pass
Jan 16, 2024
4328abd
Merge pull request #419 from xmtp-labs/dj/portable-consent
daria-github Jan 16, 2024
2762aea
test wip, updated tab switching logic
Jan 16, 2024
b52acd9
remove consent tests
Jan 16, 2024
14a1bc8
fix lint error
Jan 16, 2024
9d4a732
Merge branch 'dev' into dj/portable-consent
daria-github Jan 16, 2024
497e306
Merge pull request #420 from xmtp-labs/dj/portable-consent
daria-github Jan 17, 2024
82eccaa
updated port
Jan 17, 2024
af40140
consent test boilerplate
Jan 17, 2024
8d5c0e7
updated tab flow and tests
Jan 17, 2024
c026dfa
Merge branch 'dev' into dj/portable-consent
daria-github Jan 17, 2024
a02edc8
Merge pull request #421 from xmtp-labs/dj/portable-consent
daria-github Jan 17, 2024
6ec441f
convo list wip
Jan 19, 2024
cbc60c3
updated consent flow
Jan 22, 2024
53b294a
revert package json changes
Jan 22, 2024
a338e39
comment out code for sent messages
Jan 23, 2024
7f6d424
added db hook
Jan 23, 2024
f35b2a3
Merge branch 'dev' into dj/portable-consent-changes
daria-github Jan 23, 2024
e57d4ab
Merge pull request #422 from xmtp-labs/dj/portable-consent-changes
daria-github Jan 23, 2024
39aa0fa
bump react sdk
Jan 23, 2024
038aaa2
updated vite config for wasm
Jan 23, 2024
61f511b
Merge pull request #425 from xmtp-labs/dj/bump-react-sdk
daria-github Jan 23, 2024
17c1838
revert to pre consent sdk version
Jan 25, 2024
cfeeb55
update lockfile
Jan 25, 2024
2724b18
Merge pull request #427 from xmtp-labs/dj/revert-react-sdk-bump
daria-github Jan 25, 2024
949bb12
bumped sdk and db version
Jan 26, 2024
3b20b2b
regenerated lockfile
Jan 26, 2024
0a8fa5c
updated vite config
Jan 26, 2024
4224e51
added patch version
Jan 29, 2024
33bfd5d
Merge pull request #428 from xmtp-labs/dj/bump-sdk-5.0
daria-github Jan 29, 2024
c5c2f81
updated frames get/post logic
Feb 3, 2024
ff18531
Merge pull request #431 from xmtp-labs/dj/frames
daria-github Feb 5, 2024
0dddce1
bumped sdk version
Feb 6, 2024
3bad2d4
bumped db version
Feb 6, 2024
31e01bc
flattened props
Feb 6, 2024
ab98764
Merge branch 'dev' into dj/frames
daria-github Feb 6, 2024
e7ababe
Merge pull request #432 from xmtp-labs/dj/frames
daria-github Feb 6, 2024
cdfec08
updated to latest frames spec
Feb 6, 2024
3ec07e7
Merge branch 'dev' into dj/frames
daria-github Feb 6, 2024
a545dd2
Merge pull request #433 from xmtp-labs/dj/frames
daria-github Feb 6, 2024
38071d9
Merge branch 'main' into dj/fix-conflicts
Feb 7, 2024
cc8962c
Merge pull request #434 from xmtp-labs/dj/fix-conflicts
daria-github Feb 7, 2024
6a1080e
chore: merge upstream
MuckT Feb 10, 2024
bda29e1
build(deps): downgrade @xmtp/react-sdk
MuckT Feb 10, 2024
7cc5b09
build(deps): remove deprecated vite-plugin-rewrite-all
MuckT Feb 10, 2024
f8cc370
chore: remove setConsentFilter and consentFilter
MuckT Feb 10, 2024
8bcfb81
style: run lint and format
MuckT Feb 11, 2024
e2e71a5
style: run prettier
MuckT Feb 11, 2024
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
64,038 changes: 17,357 additions & 46,681 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"@xmtp/content-type-remote-attachment": "^1.1.4",
"@xmtp/content-type-reply": "^1.1.5",
"@xmtp/experimental-content-type-screen-effect": "^1.0.2",
"@xmtp/react-sdk": "3.1.1",
"@xmtp/frames-client": "0.2.0",
"@xmtp/react-sdk": "^3.1.1",
"buffer": "^6.0.3",
"date-fns": "^2.29.3",
"dexie": "^3.2.4",
Expand All @@ -63,6 +64,7 @@
"react-infinite-scroll-component": "^6.1.0",
"react-media-recorder-2": "^1.6.23",
"react-medium-image-zoom": "^5.1.6",
"react-modal": "^3.16.1",
"react-qrcode-logo": "^2.9.0",
"react-router-dom": "^6.12.0",
"react-timer-hook": "^3.0.6",
Expand Down Expand Up @@ -116,7 +118,6 @@
"tailwindcss": "^3.3.2",
"typescript": "^5.0.4",
"vite": "^4.3.9",
"vite-plugin-rewrite-all": "^1.0.1",
"vitest": "^0.32.0",
"walletlink": "^2.4.6"
}
Expand Down
23 changes: 12 additions & 11 deletions src/component-library/components/AddressInput/AddressInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
ChevronLeftIcon,
InformationCircleIcon,
} from "@heroicons/react/outline";
import { ChevronLeftIcon, XCircleIcon } from "@heroicons/react/outline";
import { useTranslation } from "react-i18next";
import { Avatar } from "../Avatar/Avatar";
import { classNames } from "../../../helpers";
Expand Down Expand Up @@ -41,10 +38,6 @@ interface AddressInputProps {
* Upon submit, is something loading?
*/
isLoading?: boolean;
/**
* Is there a tooltip click event that needs to be handled?
*/
onTooltipClick?: () => void;
/**
* Input Value
*/
Expand All @@ -53,6 +46,10 @@ interface AddressInputProps {
* Is there a left icon click event that needs to be handled?
*/
onLeftIconClick?: () => void;
/**
* Is there a right icon click event that needs to be handled?
*/
onRightIconClick?: () => void;
}

export const AddressInput = ({
Expand All @@ -61,9 +58,9 @@ export const AddressInput = ({
avatarUrlProps,
onChange,
isError,
onTooltipClick,
value,
onLeftIconClick,
onRightIconClick,
}: AddressInputProps) => {
const { t } = useTranslation();
const subtextColor = isError ? "text-red-600" : "text-gray-500";
Expand Down Expand Up @@ -127,8 +124,12 @@ export const AddressInput = ({
</div>
</div>
</form>
{onTooltipClick && (
<InformationCircleIcon onClick={onTooltipClick} height="24" />
{onRightIconClick && (
<XCircleIcon
onClick={onRightIconClick}
height="24"
className="text-red-600 cursor-pointer"
/>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { ConsentState } from "@xmtp/react-sdk";
import type React from "react";
import { Virtuoso } from "react-virtuoso";
import { EmptyBlocked } from "../EmptyBlocked/EmptyBlocked";
import { EmptyMessage } from "../EmptyMessage/EmptyMessage";
import { EmptyRequest } from "../EmptyRequest/EmptyRequest";
import { MessagePreviewCard } from "../MessagePreviewCard/MessagePreviewCard";
import type { ActiveTab } from "../../../store/xmtp";

interface ConversationListProps {
/**
Expand All @@ -24,35 +22,30 @@
*/
hasRecipientEnteredValue?: boolean;
/**
* Active consentFilter
* Which tab are we on?
*/
consentFilter: ConsentState;
activeTab: ActiveTab;
}

export const ConversationList = ({
messages = [],
isLoading,
setStartedFirstMessage,
hasRecipientEnteredValue,
consentFilter,
activeTab,
}: ConversationListProps) =>
!messages?.length && isLoading ? (
<div className="w-full overflow-hidden h-full flex flex-col justify-start sm:w-full bg-gray-100">
{Array.from({ length: 12 }).map((_, idx) => (
<MessagePreviewCard key={idx} isLoading />
<MessagePreviewCard key={idx} isLoading activeTab={activeTab} />

Check warning on line 40 in src/component-library/components/ConversationList/ConversationList.tsx

View workflow job for this annotation

GitHub Actions / eslint

Do not use Array index in keys
))}
</div>
) : !messages.length &&
!isLoading &&
!hasRecipientEnteredValue &&
consentFilter === "allowed" ? (
) : !messages.length && !isLoading && !hasRecipientEnteredValue ? (
<div className="w-full overflow-hidden sm:w-full sm:p-4 md:p-8 border border-gray-100 h-full">
<EmptyMessage setStartedFirstMessage={setStartedFirstMessage} />
{activeTab === "messages" ? (
<EmptyMessage setStartedFirstMessage={setStartedFirstMessage} />
) : null}
</div>
) : !messages.length && !isLoading && consentFilter === "denied" ? (
<EmptyBlocked />
) : !messages.length && !isLoading && consentFilter === "unknown" ? (
<EmptyRequest />
) : (
<Virtuoso
className="sm:w-full flex flex-col h-full bg-gray-100 border-x"
Expand Down
40 changes: 40 additions & 0 deletions src/component-library/components/Frame/Frame.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { GhostButton } from "../GhostButton/GhostButton";

type FrameProps = {
image: string;
title: string;
buttons: string[];
handleClick: (buttonNumber: number) => Promise<void>;
frameButtonUpdating: number;
};

export const Frame = ({
image,
title,
buttons,
handleClick,
frameButtonUpdating,
}: FrameProps) => (
<div className="px-4 md:px-8">
<img src={image} className="max-h-80 rounded-lg" alt={title} />
<div className="flex flex-col items-center">
{buttons?.map((button, index) => {
if (!button) {
return null;
}
const handlePress = () => {
void handleClick(index + 1);
};
return (
<GhostButton
key={button}
label={button}
onClick={handlePress}
isLoading={frameButtonUpdating === index + 1}
isDisabled={frameButtonUpdating > 0}
/>
);
})}
</div>
</div>
);
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { useTranslation } from "react-i18next";
import type { VirtuosoHandle } from "react-virtuoso";
import { Virtuoso } from "react-virtuoso";
import { useMemo, useRef } from "react";
import { useMemo, useRef, useState } from "react";
import { useConsent } from "@xmtp/react-sdk";
import { useXmtpStore } from "../../../store/xmtp";

interface FullConversationProps {
messages?: Array<JSX.Element | null>;
isLoading?: boolean;
address: string;
}

const LoadingMessage: React.FC = () => {
Expand All @@ -28,9 +31,51 @@ const BeginningMessage: React.FC = () => {
);
};

const AcceptOrDeny = ({ address }: { address: string }) => {
const { t } = useTranslation();
const { allow, deny } = useConsent();
const activeTab = useXmtpStore((s) => s.activeTab);
const changedConsentCount = useXmtpStore((s) => s.changedConsentCount);
const setChangedConsentCount = useXmtpStore((s) => s.setChangedConsentCount);

const [modalOpen, setModalOpen] = useState(true);

return activeTab === "requests" && modalOpen ? (
<div
className="bg-gray-100 p-4 w-full flex flex-col justify-center items-center text-gray-500 border-2 border-gray-300"
data-testid="accept_or_deny_container">
<h3 className="font-bold">{t("consent.new_message_request")}</h3>
<p>{t("consent.new_message_request_description")}</p>
<div className="flex w-full justify-between p-3 gap-2">
<button
type="button"
className="text-indigo-600 flex w-full justify-center border border-2 border-indigo-600 rounded-md p-2 hover:bg-indigo-600 hover:text-white"
onClick={() => {
void allow([address]);
setModalOpen(false);
setChangedConsentCount(changedConsentCount + 1);
}}>
{t("consent.accept")}
</button>
<button
type="button"
className="text-red-600 flex w-full justify-center border border-2 border-red-600 rounded-md p-2 hover:bg-red-600 hover:text-white"
onClick={() => {
void deny([address]);
setModalOpen(false);
setChangedConsentCount(changedConsentCount + 1);
}}>
{t("consent.block")}
</button>
</div>
</div>
) : null;
};

export const FullConversation = ({
messages = [],
isLoading = false,
address,
}: FullConversationProps) => {
const virtuosoRef = useRef<VirtuosoHandle>(null);
const filteredMessages = useMemo(() => {
Expand All @@ -42,8 +87,9 @@ export const FullConversation = ({
<BeginningMessage key="beginning" />
),
...filtered,
<AcceptOrDeny key={address} address={address} />,
];
}, [isLoading, messages]);
}, [isLoading, messages, address]);

return (
<Virtuoso
Expand Down
Loading
Loading