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

Deploy/epic #687

Merged
merged 40 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
89f48be
Add max height to image
Jul 8, 2024
e36c239
Add moderate tabs
Jul 8, 2024
f2ddd85
Remove unnecessary component
Jul 8, 2024
8d0a33b
Finish approve flow
Jul 8, 2024
14828ef
Finish checker for approved in root post id
Jul 8, 2024
1fb567c
Add profile posts list modal
samchuk-vlad Jul 9, 2024
78cbc19
Improve toast after sending meme
Jul 9, 2024
dfc48a3
Make checkmark not clickable
Jul 9, 2024
4a74d8b
Improve position of time in chat with approve button layout
Jul 9, 2024
0459064
Add posts to profile modal
samchuk-vlad Jul 9, 2024
86854c6
Merge remote-tracking branch 'origin/deploy/epic' into posts-by-user
samchuk-vlad Jul 9, 2024
9396acd
Merge branch 'posts-by-user' into deploy/epic
samchuk-vlad Jul 9, 2024
646759a
Insert data based on create time
Jul 9, 2024
7118f8f
Finish showing user's unapproved comment
Jul 9, 2024
5b85eda
Change style of pending review
Jul 9, 2024
2eb89ba
Change style of pending review
Jul 9, 2024
78a40c5
Merge branch 'deploy/epic' of https://github.com/dappforce/grillchat …
Jul 9, 2024
9445ed1
Add loading to approve button
Jul 9, 2024
31059bb
Add evm address copy and fix wrong query
Jul 9, 2024
8e3b8eb
Add datahub health checker
Jul 9, 2024
5ae62c0
Remove unused func
Jul 9, 2024
f9bb317
Add datahub health api
Jul 9, 2024
49db2a5
Not open error toast at first launch
Jul 9, 2024
53eb6d3
Add stale time to refetch
Jul 9, 2024
972b7e3
Refetch using manual visibility change
Jul 9, 2024
135f20a
Fix image modal
Jul 9, 2024
947e668
Change time constraint to use env
Jul 9, 2024
2f2e2a0
Add fix for profile posts list modal
samchuk-vlad Jul 10, 2024
686f1e3
Fix multiple chat menu opening in profile posts
Jul 10, 2024
ac0d385
Merge branch 'deploy/epic' of https://github.com/dappforce/grillchat …
Jul 10, 2024
916ebe1
Remove offset because it causes bad alignment in mobile (ios)
Jul 10, 2024
c29d5cb
Reduce padding
Jul 10, 2024
1de3290
Fix issue where non approved memes not added in pending tabs
Jul 10, 2024
821f691
Fix issue with image loaded but send button is still disabled
Jul 10, 2024
677b9b6
Merge branch 'epic-base' of https://github.com/dappforce/grillchat in…
Jul 10, 2024
5434cfc
Add minimum 3 unapproved meme to review
Jul 10, 2024
b09e543
Separate unapproved meme count between different chatIds
Jul 10, 2024
9b692c1
Add modal for notice
Jul 10, 2024
54b4ae0
Change check icon to higher res
Jul 10, 2024
0759690
Update wording
Jul 10, 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
2 changes: 2 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
GH_NEXT_PUBLIC_CONTEST_CHAT_ID=0x0106b70599fea6682ec0de3c6ab248d4
GH_NEXT_PUBLIC_CONTEST_NAME=MEMECOIN CONTEST
GH_NEXT_PUBLIC_CONTEST_END_TIME=1720796400739
GH_NEXT_PUBLIC_TIME_CONSTRAINT=300000
GH_NEXT_PUBLIC_AMP_ID=40d4174295c7edf657fc3bedf2748549
GH_NEXT_PUBLIC_COMMUNITY_HUB_ID=12455
GH_NEXT_PUBLIC_GA_ID=G-TP1XEFNHQD
Expand Down Expand Up @@ -113,6 +114,7 @@ jobs:
GH_NEXT_PUBLIC_CONTEST_CHAT_ID=0x850f0f5c0c244eba16425a464b0becfc
GH_NEXT_PUBLIC_CONTEST_NAME=MEMECOIN CONTEST
GH_NEXT_PUBLIC_CONTEST_END_TIME=1720796400739
GH_NEXT_PUBLIC_TIME_CONSTRAINT=5000
GH_NEXT_PUBLIC_TELEGRAM_NOTIFICATION_BOT=https://t.me/g_notif_staging_bot/
GH_TELEGRAM_BOT_TOKEN="7038999347:AAGBgXTWcXpR4vZPW9A8_ia9PkWOpeyDeWA"
# without base path
Expand Down
1 change: 1 addition & 0 deletions ci.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ NEXT_PUBLIC_MAIN_CHAT_ID='$GH_NEXT_PUBLIC_MAIN_CHAT_ID'
NEXT_PUBLIC_CONTEST_CHAT_ID='$GH_NEXT_PUBLIC_CONTEST_CHAT_ID'
NEXT_PUBLIC_CONTEST_NAME='$GH_NEXT_PUBLIC_CONTEST_NAME'
NEXT_PUBLIC_CONTEST_END_TIME='$GH_NEXT_PUBLIC_CONTEST_END_TIME'
NEXT_PUBLIC_TIME_CONSTRAINT='$GH_NEXT_PUBLIC_TIME_CONSTRAINT'
NEXT_PUBLIC_BASE_PATH='$GH_NEXT_PUBLIC_BASE_PATH'
NEXT_PUBLIC_NEYNAR_CLIENT_ID='$GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID'
NEXT_PUBLIC_TELEGRAM_BOT_ID='$GH_NEXT_PUBLIC_TELEGRAM_BOT_ID'
Expand Down
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ARG GH_NEXT_PUBLIC_MAIN_CHAT_ID
ARG GH_NEXT_PUBLIC_CONTEST_CHAT_ID
ARG GH_NEXT_PUBLIC_CONTEST_NAME
ARG GH_NEXT_PUBLIC_CONTEST_END_TIME
ARG GH_NEXT_PUBLIC_TIME_CONSTRAINT
ARG GH_NEXT_PUBLIC_BASE_PATH
ARG GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID
ARG GH_NEXT_PUBLIC_TELEGRAM_BOT_ID
Expand Down Expand Up @@ -42,6 +43,7 @@ ENV NEXTAUTH_URL=${GH_NEXTAUTH_URL} \
NEXT_PUBLIC_CONTEST_CHAT_ID=${GH_NEXT_PUBLIC_CONTEST_CHAT_ID} \
NEXT_PUBLIC_CONTEST_NAME=${GH_NEXT_PUBLIC_CONTEST_NAME} \
NEXT_PUBLIC_CONTEST_END_TIME=${GH_NEXT_PUBLIC_CONTEST_END_TIME} \
NEXT_PUBLIC_TIME_CONSTRAINT=${GH_NEXT_PUBLIC_TIME_CONSTRAINT} \
NEXT_PUBLIC_BASE_PATH=${GH_NEXT_PUBLIC_BASE_PATH} \
NEXT_PUBLIC_NEYNAR_CLIENT_ID=${GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID} \
NEXT_PUBLIC_TELEGRAM_BOT_ID=${GH_NEXT_PUBLIC_TELEGRAM_BOT_ID} \
Expand Down Expand Up @@ -100,6 +102,7 @@ ARG GH_NEXT_PUBLIC_MAIN_CHAT_ID
ARG GH_NEXT_PUBLIC_CONTEST_CHAT_ID
ARG GH_NEXT_PUBLIC_CONTEST_NAME
ARG GH_NEXT_PUBLIC_CONTEST_END_TIME
ARG GH_NEXT_PUBLIC_TIME_CONSTRAINT
ARG GH_NEXT_PUBLIC_BASE_PATH
ARG GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID
ARG GH_NEXT_PUBLIC_TELEGRAM_BOT_ID
Expand Down Expand Up @@ -128,6 +131,7 @@ ENV NEXTAUTH_URL=${GH_NEXTAUTH_URL} \
NEXT_PUBLIC_CONTEST_CHAT_ID=${GH_NEXT_PUBLIC_CONTEST_CHAT_ID} \
NEXT_PUBLIC_CONTEST_NAME=${GH_NEXT_PUBLIC_CONTEST_NAME} \
NEXT_PUBLIC_CONTEST_END_TIME=${GH_NEXT_PUBLIC_CONTEST_END_TIME} \
NEXT_PUBLIC_TIME_CONSTRAINT=${GH_NEXT_PUBLIC_TIME_CONSTRAINT} \
NEXT_PUBLIC_BASE_PATH=${GH_NEXT_PUBLIC_BASE_PATH} \
NEXT_PUBLIC_NEYNAR_CLIENT_ID=${GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID} \
NEXT_PUBLIC_TELEGRAM_BOT_ID=${GH_NEXT_PUBLIC_TELEGRAM_BOT_ID} \
Expand Down
1 change: 1 addition & 0 deletions src/@types/subsocial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ declare module '@subsocial/api/types' {
blockchainSyncFailed?: boolean
dataType?: 'persistent' | 'optimistic' | 'offChain'
parentPostId?: string | null
approvedInRootPost?: boolean
},
PostContent
> & { requestedId?: string }
Expand Down
Binary file modified src/assets/emojis/check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/emojis/time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const buttonStyles = cva('relative transition', {
muted: 'bg-background-lightest !ring-background-lightest text-text-muted',
transparent: 'bg-transparent border border-transparent',
redOutline: 'bg-transparent border border-text-red !ring-text-red',
greenOutline:
'bg-transparent border border-green-500 !ring-green-500 text-green-500',
landingPrimary:
'bg-gradient-to-r from-[#DB4646] to-[#F9A11E] text-white hover:!ring-white/50 focus-visible:!ring-white/50',
landingPrimaryOutline:
Expand Down
3 changes: 2 additions & 1 deletion src/components/MediaLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,13 @@ export default function MediaLoader({
alt={props.alt || ''}
className={cx(
commonProps.className,
'absolute inset-0 m-0 h-full w-full p-0'
'absolute inset-0 m-0 h-full max-h-96 w-full scale-110 object-cover p-0 blur-lg'
)}
/>
<Image
{...commonProps}
loading='eager'
className={cx('max-h-96 object-contain', commonProps.className)}
style={{ backfaceVisibility: 'hidden', ...commonProps.style }}
width={commonProps.width || 500}
height={commonProps.height || 500}
Expand Down
52 changes: 24 additions & 28 deletions src/components/ProfilePreviewModalWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useProfilePostsModal } from '@/stores/profile-posts-modal'
import { cx } from '@/utils/class-names'
import { useState } from 'react'
import Name, { NameProps } from './Name'
Expand All @@ -14,7 +15,6 @@ export type ProfilePreviewModalWrapperProps = {

export default function ProfilePreviewModalWrapper({
address,
messageId,
children,
}: ProfilePreviewModalWrapperProps) {
const [isOpenAccountModal, setIsOpenAccountModal] = useState(false)
Expand All @@ -32,41 +32,37 @@ export default function ProfilePreviewModalWrapper({
closeModal={() => setIsOpenAccountModal(false)}
>
<ProfilePreview asLink address={address} className='mb-2' />
{/* {messageId && (
<ActionCard
className='mt-2'
actions={[
{
icon: RiCopperCoinLine,
text: 'Donate',
iconClassName: cx('text-text-muted'),
onClick: () => openDonateExtension(),
},
]}
/>
)} */}
</Modal>
</>
)
}

export function ProfilePreviewModalName({
messageId,
chatId,
hubId,
enableProfileModal = true,
...props
}: NameProps & { messageId?: string }) {
}: NameProps & {
messageId: string
chatId: string
hubId: string
enableProfileModal?: boolean
}) {
const { openModal } = useProfilePostsModal()

return (
<ProfilePreviewModalWrapper address={props.address} messageId={messageId}>
{(onClick) => (
<Name
{...props}
onClick={(e) => {
onClick(e)
props.onClick?.(e)
}}
className={cx('cursor-pointer', props.className)}
address={props.address}
/>
)}
</ProfilePreviewModalWrapper>
<Name
{...props}
onClick={(e) => {
if (enableProfileModal) {
e.preventDefault()
openModal({ messageId, chatId, hubId, address: props.address })
props.onClick?.(e)
}
}}
className={cx('cursor-pointer', props.className)}
address={props.address}
/>
)
}
51 changes: 26 additions & 25 deletions src/components/chats/ChatItem/ChatItem.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import AddressAvatar from '@/components/AddressAvatar'
import ProfilePreviewModalWrapper from '@/components/ProfilePreviewModalWrapper'
import { isMessageSent } from '@/services/subsocial/commentIds/optimistic'
import { useMessageData } from '@/stores/message'
import { useProfilePostsModal } from '@/stores/profile-posts-modal'
import { cx } from '@/utils/class-names'
import { PostData } from '@subsocial/api/types'
import { ComponentProps } from 'react'
import { ScrollToMessage } from '../ChatList/hooks/useScrollToMessage'
import ChatItemMenus from './ChatItemMenus'
import ChatItemWithExtension from './ChatItemWithExtension'
import Embed, { useCanRenderEmbed } from './Embed'
import { getMessageStatusById } from './MessageStatusIndicator'
import DefaultChatItem from './variants/DefaultChatItem'
import EmojiChatItem, {
shouldRenderEmojiChatItem,
Expand All @@ -21,9 +18,12 @@ export type ChatItemProps = Omit<ComponentProps<'div'>, 'children'> & {
messageBubbleId?: string
scrollToMessage?: ScrollToMessage
enableChatMenu?: boolean
enableProfileModal?: boolean
chatId: string
hubId: string
bg?: 'background-light' | 'background'
showApproveButton?: boolean
menuIdPrefix?: string
}

export default function ChatItem({
Expand All @@ -35,28 +35,24 @@ export default function ChatItem({
chatId,
hubId,
bg = 'background-light',
showApproveButton,
enableProfileModal = true,
menuIdPrefix,
...props
}: ChatItemProps) {
const setReplyTo = useMessageData((state) => state.setReplyTo)

const messageId = message.id
const { ownerId, dataType } = message.struct
const { ownerId, id: messageId } = message.struct
const { body, extensions, link } = message.content || {}

const setMessageAsReply = () => {
if (!isMessageSent(messageId, dataType)) return
setReplyTo(messageId)
}
const { openModal } = useProfilePostsModal()

const canRenderEmbed = useCanRenderEmbed(link ?? '')

if (showApproveButton && message.struct.approvedInRootPost) return null

if (!body && (!extensions || extensions.length === 0)) return null

const isEmojiOnly = shouldRenderEmojiChatItem(body ?? '')
const ChatItemContentVariant = isEmojiOnly ? EmojiChatItem : DefaultChatItem

const messageStatus = getMessageStatusById(message)

return (
<>
<div
Expand All @@ -68,17 +64,20 @@ export default function ChatItem({
)}
>
{!isMyMessage && (
<ProfilePreviewModalWrapper address={ownerId} messageId={message.id}>
{(onClick) => (
<AddressAvatar
onClick={onClick}
address={ownerId}
className='flex-shrink-0 cursor-pointer'
/>
)}
</ProfilePreviewModalWrapper>
<AddressAvatar
onClick={(e) => {
e.preventDefault()

if (enableProfileModal) {
openModal({ chatId, hubId, messageId, address: ownerId })
}
}}
address={ownerId}
className='flex-shrink-0 cursor-pointer'
/>
)}
<ChatItemMenus
menuIdPrefix={menuIdPrefix}
chatId={chatId}
messageId={message.id}
enableChatMenu={enableChatMenu}
Expand All @@ -94,7 +93,6 @@ export default function ChatItem({
e.preventDefault()
toggleDisplay?.(e)
}}
// onDoubleClick={() => setMessageAsReply()}
{...referenceProps}
id={messageBubbleId}
>
Expand All @@ -105,14 +103,17 @@ export default function ChatItem({
isMyMessage={isMyMessage}
chatId={chatId}
hubId={hubId}
enableProfileModal={enableProfileModal}
bg={bg}
showApproveButton={showApproveButton}
/>
) : (
<ChatItemContentVariant
message={message}
isMyMessage={isMyMessage}
scrollToMessage={scrollToMessage}
chatId={chatId}
enableProfileModal={enableProfileModal}
hubId={hubId}
bg={bg}
/>
Expand Down
Loading
Loading