From 870086be46db41a1e3199fecc198395c29b91c24 Mon Sep 17 00:00:00 2001 From: Julian Jelfs Date: Fri, 18 Oct 2024 11:20:08 +0100 Subject: [PATCH] Gate expiry support on the front end (#6599) --- frontend/app/src/components/Hoverable.svelte | 2 +- .../home/ChannelOrCommunityMembers.svelte | 4 + .../home/ChannelOrCommunitySummary.svelte | 2 +- .../app/src/components/home/ChatList.svelte | 2 +- .../src/components/home/CurrentChat.svelte | 4 +- .../home/CurrentChatMessages.svelte | 4 +- .../src/components/home/DurationPicker.svelte | 47 +++-- .../app/src/components/home/Footer.svelte | 2 + frontend/app/src/components/home/Home.svelte | 16 +- .../src/components/home/MessageEntry.svelte | 5 +- .../src/components/home/NoChatSelected.svelte | 7 +- .../src/components/home/PreviewFooter.svelte | 25 ++- .../components/home/RecommendedGroup.svelte | 4 +- .../app/src/components/home/RightPanel.svelte | 32 ++-- .../components/home/VisibilityControl.svelte | 6 +- .../home/access/AccessGateBuilder.svelte | 114 +++++++++--- .../home/access/AccessGateCheckFailed.svelte | 9 +- .../home/access/AccessGateControl.svelte | 16 +- .../home/access/AccessGateEvaluator.svelte | 85 ++++++--- .../home/access/AccessGateExpiry.svelte | 57 ++++++ .../home/access/AccessGateIcon.svelte | 66 +++++-- .../home/access/AccessGateIconsForChat.svelte | 9 +- .../home/access/AccessGateSummary.svelte | 12 +- .../access/CredentialGateEvaluator.svelte | 9 +- .../home/access/PaymentGateEvaluator.svelte | 39 ++++- .../access/UniqueHumanGateEvaluator.svelte | 9 + .../components/home/addgroup/NewGroup.svelte | 7 +- .../home/communities/PreviewWrapper.svelte | 30 ++-- .../communities/details/ChannelCard.svelte | 2 +- .../details/CommunityDetails.svelte | 17 +- .../details/CommunitySummary.svelte | 2 +- .../home/communities/edit/Edit.svelte | 9 +- .../communities/explore/CommunityCard.svelte | 6 +- .../home/communities/explore/Explore.svelte | 2 +- .../home/groupdetails/BlockedUser.svelte | 3 +- .../home/groupdetails/GroupDetailsBody.svelte | 18 +- .../home/groupdetails/InvitedUser.svelte | 3 +- .../home/groupdetails/Member.svelte | 1 + .../home/groupdetails/Members.svelte | 129 ++++++++++---- .../components/home/groupdetails/User.svelte | 1 + .../src/components/home/thread/Thread.svelte | 1 + frontend/app/src/i18n/cn.json | 10 ++ frontend/app/src/i18n/de.json | 10 ++ frontend/app/src/i18n/en.json | 10 ++ frontend/app/src/i18n/es.json | 10 ++ frontend/app/src/i18n/fa.json | 10 ++ frontend/app/src/i18n/fr.json | 10 ++ frontend/app/src/i18n/hi.json | 10 ++ frontend/app/src/i18n/it.json | 10 ++ frontend/app/src/i18n/iw.json | 10 ++ frontend/app/src/i18n/jp.json | 10 ++ frontend/app/src/i18n/pl.json | 10 ++ frontend/app/src/i18n/ru.json | 10 ++ frontend/app/src/i18n/uk.json | 10 ++ frontend/app/src/i18n/vi.json | 10 ++ frontend/app/src/stores/community.ts | 3 +- frontend/app/src/utils/time.ts | 21 +++ .../src/services/candidService.ts | 9 +- .../src/services/common/chatMappers.ts | 21 ++- .../src/services/common/chatMappersV2.ts | 65 +++++-- .../services/common/publicSummaryMapperV2.ts | 7 +- .../services/community/community.client.ts | 40 ++--- .../src/services/community/mappersV2.ts | 40 +++-- .../src/services/group/group.client.ts | 29 ++- .../src/services/group/mappersV2.ts | 71 +++++--- .../src/services/groupIndex/mappers.ts | 7 +- .../localUserIndex/localUserIndex.client.ts | 5 +- .../src/services/openchatAgent.ts | 8 +- .../services/proposalsBot/candid/types.d.ts | 1 + .../services/storageBucket/candid/types.d.ts | 1 + .../services/storageIndex/candid/types.d.ts | 1 + .../services/translations/candid/types.d.ts | 1 + .../src/services/user/candid/types.d.ts | 1 + .../src/services/user/mappers.ts | 1 + .../src/services/user/user.client.ts | 8 +- frontend/openchat-agent/src/utils/caching.ts | 31 ++-- frontend/openchat-agent/src/utils/chat.ts | 38 ++-- .../openchat-agent/src/utils/community.ts | 14 +- frontend/openchat-client/src/openchat.ts | 165 ++++++++++++------ frontend/openchat-client/src/stores/chat.ts | 8 + .../openchat-client/src/stores/community.ts | 6 + .../src/stores/localChatSummaryUpdates.ts | 2 +- .../openchat-client/src/utils/chat.spec.ts | 3 +- frontend/openchat-client/src/utils/chat.ts | 19 +- .../openchat-client/src/utils/community.ts | 4 + frontend/openchat-client/src/utils/time.ts | 14 +- frontend/openchat-shared/src/constants.ts | 2 + frontend/openchat-shared/src/domain/access.ts | 10 +- .../openchat-shared/src/domain/chat/chat.ts | 48 +++-- .../src/domain/community/index.ts | 24 +-- .../openchat-shared/src/domain/permission.ts | 1 + .../src/domain/search/search.ts | 4 +- frontend/openchat-shared/src/domain/worker.ts | 6 +- frontend/openchat-worker/src/worker.ts | 4 +- 94 files changed, 1253 insertions(+), 448 deletions(-) create mode 100644 frontend/app/src/components/home/access/AccessGateExpiry.svelte create mode 100644 frontend/app/src/utils/time.ts diff --git a/frontend/app/src/components/Hoverable.svelte b/frontend/app/src/components/Hoverable.svelte index 9352787da4..9f0ac5d6b9 100644 --- a/frontend/app/src/components/Hoverable.svelte +++ b/frontend/app/src/components/Hoverable.svelte @@ -134,7 +134,7 @@ diff --git a/frontend/app/src/components/home/RecommendedGroup.svelte b/frontend/app/src/components/home/RecommendedGroup.svelte index 6bf9b6c498..35c6cb82ed 100644 --- a/frontend/app/src/components/home/RecommendedGroup.svelte +++ b/frontend/app/src/components/home/RecommendedGroup.svelte @@ -32,7 +32,7 @@ $: chatListScope = client.chatListScope; $: chatSummariesStore = client.chatSummariesStore; $: member = $chatSummariesStore.has(group.id); - $: locked = isLocked(group.gate); + $: locked = isLocked(group.gateConfig.gate); function dismiss({ id }: GroupChatSummary) { dispatch("dismissRecommendation", id); @@ -84,7 +84,7 @@