diff --git a/packages/ui/src/accounts/components/Accounts.tsx b/packages/ui/src/accounts/components/Accounts.tsx index d1f299bf66..a9839c6505 100644 --- a/packages/ui/src/accounts/components/Accounts.tsx +++ b/packages/ui/src/accounts/components/Accounts.tsx @@ -99,6 +99,7 @@ interface HeaderProps { } const AccountsWrap = styled.div` + overflow: auto; display: grid; grid-template-columns: 1fr; grid-template-rows: 16px auto; diff --git a/packages/ui/src/app/GlobalModals.tsx b/packages/ui/src/app/GlobalModals.tsx index 760aac41c3..fb529ba0aa 100644 --- a/packages/ui/src/app/GlobalModals.tsx +++ b/packages/ui/src/app/GlobalModals.tsx @@ -25,9 +25,11 @@ import { TransferModal, TransferModalCall } from '@/accounts/modals/TransferModa import { FailureModal } from '@/common/components/FailureModal' import { Loading } from '@/common/components/Loading' import { ModalGlass } from '@/common/components/Modal' +import { NotSupportMobileModal } from '@/common/components/NotSupportMobileModal' import { SearchResultsModal, SearchResultsModalCall } from '@/common/components/Search/SearchResultsModal' import { SuccessModal } from '@/common/components/SuccessModal' import { useModal } from '@/common/hooks/useModal' +import { useResponsive } from '@/common/hooks/useResponsive' import { useTransactionStatus } from '@/common/hooks/useTransactionStatus' import { ConfirmModal } from '@/common/modals/ConfirmModal/ConfirmModal' import { OnBoardingModal, OnBoardingModalCall } from '@/common/modals/OnBoardingModal' @@ -203,10 +205,13 @@ export const MODAL_WITH_CLOSE_CONFIRMATION: ModalNames[] = [ 'VoteForProposalModal', ] +const NON_TRANSACTIONAL_MODALS: ModalNames[] = ['Member', 'ApplicationDetails', 'VoteRationaleModal', 'SearchResults'] + export const GlobalModals = () => { const { modal, hideModal, currentModalMachine, showModal, modalData, isClosing } = useModal() const { active: activeMember } = useMyMemberships() const { status } = useTransactionStatus() + const { supportTransactions } = useResponsive() const Modal = useMemo(() => (modal && modal in modals ? memo(() => modals[modal as ModalNames]) : null), [modal]) const [container, setContainer] = useState(document.body) @@ -217,6 +222,10 @@ export const GlobalModals = () => { const potentialFallback = useGlobalModalHandler(currentModalMachine, hideModal) + if (modal && !supportTransactions && !NON_TRANSACTIONAL_MODALS.includes(modal as ModalNames)) { + return + } + if (modal && !GUEST_ACCESSIBLE_MODALS.includes(modal as ModalNames) && !activeMember) { showModal({ modal: 'SwitchMember', diff --git a/packages/ui/src/app/components/SideBar.tsx b/packages/ui/src/app/components/SideBar.tsx index 1cc91d5cec..58662e5710 100644 --- a/packages/ui/src/app/components/SideBar.tsx +++ b/packages/ui/src/app/components/SideBar.tsx @@ -32,6 +32,7 @@ import { NavigationHeader } from '@/common/components/page/Sidebar/NavigationHea import { NAVIGATION_LINK_GAP, NavigationLink } from '@/common/components/page/Sidebar/NavigationLink' import { Colors, RemoveScrollbar } from '@/common/constants' import { useNetworkEndpoints } from '@/common/hooks/useNetworkEndpoints' +import { useResponsive } from '@/common/hooks/useResponsive' import { useToggle } from '@/common/hooks/useToggle' import { CouncilRoutes, ElectionRoutes } from '@/council/constants' import { useElectionStage } from '@/council/hooks/useElectionStage' @@ -59,6 +60,7 @@ export const SideBar = () => { } export const SideBarContent = () => { + const { supportTransactions } = useResponsive() const [comingSoonListActive, toggleComingSoonListActive] = useToggle(false) const { stage: electionStage } = useElectionStage() const [endpoints] = useNetworkEndpoints() @@ -75,11 +77,13 @@ export const SideBarContent = () => { {/* Overview*/} {/* */} {/**/} - - }> - My profile - - + {supportTransactions && ( + + }> + My profile + + + )} }> Working Groups diff --git a/packages/ui/src/app/components/SideBarSlider.tsx b/packages/ui/src/app/components/SideBarSlider.tsx index 411f543d23..693eef50c2 100644 --- a/packages/ui/src/app/components/SideBarSlider.tsx +++ b/packages/ui/src/app/components/SideBarSlider.tsx @@ -25,7 +25,7 @@ export const SideBarSlider = React.memo(({ setOpen }: Props) => { useEscape(() => hideSideBarSlider()) return ( - + @@ -36,7 +36,7 @@ export const SideBarSlider = React.memo(({ setOpen }: Props) => { - + ) }) @@ -72,3 +72,9 @@ const CloseIconWrapper = styled.div` background-color: ${Colors.Black[600]}; } ` + +const SidePaneGlassWrapper = styled(SidePaneGlass)` + @media (max-width: 767px) { + display: flex; + } +` diff --git a/packages/ui/src/app/pages/Profile/MyMemberships.tsx b/packages/ui/src/app/pages/Profile/MyMemberships.tsx index 75eebead9d..5e4800ef33 100644 --- a/packages/ui/src/app/pages/Profile/MyMemberships.tsx +++ b/packages/ui/src/app/pages/Profile/MyMemberships.tsx @@ -1,4 +1,5 @@ import React from 'react' +import styled from 'styled-components' import { PageLayout, PageHeaderWrapper, PageHeaderRow } from '@/app/components/PageLayout' import { ButtonsGroup } from '@/common/components/buttons' @@ -14,7 +15,7 @@ export const MyMemberships = () => ( - + My Profile Invite a member @@ -23,10 +24,32 @@ export const MyMemberships = () => ( Add Membership - + } main={} /> ) + +const MyMembershipsHeaderWrapper = styled(PageHeaderRow)` + @media (max-width: 768px) { + display: flex; + flex-direction: column; + gap: 16px; + + ${ButtonsGroup} { + grid-auto-flow: row; + grid-row-gap: 8px; + width: 100%; + + button { + width: 100%; + display: flex; + justify-content: center; + align-items: center: + gap: 4px; + } + } + } +` diff --git a/packages/ui/src/common/components/Modal/Modal.tsx b/packages/ui/src/common/components/Modal/Modal.tsx index 731d068bc8..b4048ca200 100644 --- a/packages/ui/src/common/components/Modal/Modal.tsx +++ b/packages/ui/src/common/components/Modal/Modal.tsx @@ -222,7 +222,7 @@ export const ModalWrap = styled.section` 'modalfooter'; grid-area: modal; background-color: ${Colors.White}; - width: 100%; + width: calc(100% - 64px); max-width: ${({ modalMaxSize }) => { switch (modalMaxSize) { case 'xs': diff --git a/packages/ui/src/common/components/NotSupportMobileModal.tsx b/packages/ui/src/common/components/NotSupportMobileModal.tsx new file mode 100644 index 0000000000..040a0a7828 --- /dev/null +++ b/packages/ui/src/common/components/NotSupportMobileModal.tsx @@ -0,0 +1,17 @@ +import React from 'react' + +import { Modal, ModalBody, ModalHeader } from '@/common/components/Modal' +import { TextMedium } from '@/common/components/typography' + +interface Props { + onClose: () => void +} + +export const NotSupportMobileModal = ({ onClose }: Props) => ( + + + + This action requires a browser extension, please visit this page from a desktop browser. + + +) diff --git a/packages/ui/src/common/components/Pagination/Pagination.tsx b/packages/ui/src/common/components/Pagination/Pagination.tsx index 5b47873796..7962ce3ecf 100644 --- a/packages/ui/src/common/components/Pagination/Pagination.tsx +++ b/packages/ui/src/common/components/Pagination/Pagination.tsx @@ -5,6 +5,7 @@ import styled from 'styled-components' import { Arrow } from '@/common/components/icons' import { BorderRad, Colors, Fonts, Transitions } from '@/common/constants/styles' +import { useResponsive } from '@/common/hooks/useResponsive' interface PaginationProps { pageCount?: number @@ -14,6 +15,7 @@ interface PaginationProps { export const Pagination: FC = ({ pageCount = 0, handlePageChange, page }) => { const history = useHistory() + const { size } = useResponsive() if (pageCount < 2) { return null @@ -27,8 +29,8 @@ export const Pagination: FC = ({ pageCount = 0, handlePageChang ` display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); - gap: ${({ gapSize }) => (gapSize === 's' ? '16px' : '24px')}; + gap: 16px; width: 100%; max-width: 100%; ${({ withMargin }) => (withMargin ? 'margin-top: 8px;' : null)}; + @media (min-width: 1440px) { + gap: ${({ gapSize }) => (gapSize === 's' ? '16px' : '24px')}; + } ` export const StatisticsThreeColumns = styled.div` diff --git a/packages/ui/src/common/providers/responsive/context.ts b/packages/ui/src/common/providers/responsive/context.ts index 11e41b60f9..93712b2c34 100644 --- a/packages/ui/src/common/providers/responsive/context.ts +++ b/packages/ui/src/common/providers/responsive/context.ts @@ -3,9 +3,11 @@ import { createContext } from 'react' export interface UseResponsive { size: 'xxs' | 'xs' | 'sm' | 'md' | 'lg' isMobile: boolean + supportTransactions: boolean } export const ResponsiveContext = createContext({ size: 'lg', isMobile: false, + supportTransactions: true, }) diff --git a/packages/ui/src/common/providers/responsive/provider.tsx b/packages/ui/src/common/providers/responsive/provider.tsx index 58c3ac3332..9235d04275 100644 --- a/packages/ui/src/common/providers/responsive/provider.tsx +++ b/packages/ui/src/common/providers/responsive/provider.tsx @@ -32,6 +32,7 @@ export const ResponsiveProvider = (props: Props) => { ? 'xs' : 'xxs', isMobile: windowWidth < 1024, + supportTransactions: screen.width >= 768, }), [windowWidth] ) diff --git a/packages/ui/src/memberships/components/MemberList/Members.tsx b/packages/ui/src/memberships/components/MemberList/Members.tsx index e370cf3247..8dd2b8f672 100644 --- a/packages/ui/src/memberships/components/MemberList/Members.tsx +++ b/packages/ui/src/memberships/components/MemberList/Members.tsx @@ -1,4 +1,5 @@ import React from 'react' +import styled from 'styled-components' import { MembershipOrderByInput } from '@/common/api/queries' import { List, ListItem } from '@/common/components/List' @@ -30,7 +31,7 @@ export const MemberList = ({ isLoading, members, getSortProps, searchFilter }: M } return ( -
+ Memberships Roles @@ -48,6 +49,10 @@ export const MemberList = ({ isLoading, members, getSortProps, searchFilter }: M ))} -
+ ) } + +const MemberListWrapper = styled.div` + overflow: auto; +` diff --git a/packages/ui/src/memberships/components/MemberListFilters/MemberListFilters.tsx b/packages/ui/src/memberships/components/MemberListFilters/MemberListFilters.tsx index 4423a8abeb..0002736d7a 100644 --- a/packages/ui/src/memberships/components/MemberListFilters/MemberListFilters.tsx +++ b/packages/ui/src/memberships/components/MemberListFilters/MemberListFilters.tsx @@ -147,53 +147,54 @@ export const MemberListFilters = ({ memberCount, onApply }: MemberListFiltersPro All members - - { - dispatch({ type: 'change', field: 'roles', value }) - onApply({ ...filters, roles: value }) - }} - onApply={applyFilters} - onClear={() => { - dispatch({ type: 'change', field: 'roles', value: [] }) - onApply({ ...filters, roles: [] }) - }} - /> - - Member Type - - + { - dispatch({ type: 'change', field: 'onlyFounder', value }) - onApply({ ...filters, onlyFounder: value }) + dispatch({ type: 'change', field: 'roles', value }) + onApply({ ...filters, roles: value }) }} - > - - - { - dispatch({ type: 'change', field: 'onlyCouncil', value }) - onApply({ ...filters, onlyCouncil: value }) - }} - > - - - { - dispatch({ type: 'change', field: 'onlyVerified', value }) - onApply({ ...filters, onlyVerified: value }) + onApply={applyFilters} + onClear={() => { + dispatch({ type: 'change', field: 'roles', value: [] }) + onApply({ ...filters, roles: [] }) }} - > - - - + /> + + Member Type + + { + dispatch({ type: 'change', field: 'onlyFounder', value }) + onApply({ ...filters, onlyFounder: value }) + }} + > + + + { + dispatch({ type: 'change', field: 'onlyCouncil', value }) + onApply({ ...filters, onlyCouncil: value }) + }} + > + + + { + dispatch({ type: 'change', field: 'onlyVerified', value }) + onApply({ ...filters, onlyVerified: value }) + }} + > + + + + ) @@ -208,16 +209,20 @@ const Wrapper = styled.div` width: 440px; flex-direction: row-reverse; + @media (max-width: 768px) { + width: 100%; + flex-direction: column-reverse; + } + label { > *:first-child { - height: 100%; + height: 40px; } } } ` const MembersFilterBox = styled(FilterBox)` - height: 72px; margin-top: 8px; ${Fields} { @@ -226,10 +231,10 @@ const MembersFilterBox = styled(FilterBox)` gap: 16px; padding: 8px 16px; height: 100%; - } - ${SelectContainer} { - flex-basis: 220px; + @media (max-width: 768px) { + flex-direction: column; + } } ` @@ -240,11 +245,30 @@ const FieldsHeader = styled.div` margin-right: auto; ` +const FilterContentWrapper = styled.div` + display: flex; + gap: 16px; + padding: 8px 8px 12px 8px; + + ${SelectContainer} { + width: 220px; + } + + @media (max-width: 425px) { + flex-direction: column; + } + + @media (max-width: 768px) { + margin-right: auto; + } +` + const ToggleContainer = styled.div` display: grid; gap: 4px 8px; grid-template-columns: auto 1fr; height: 48px; + width: fit-content; & > :first-child { grid-column: span 3; diff --git a/packages/ui/src/memberships/components/MemberListItem/Fields.tsx b/packages/ui/src/memberships/components/MemberListItem/Fields.tsx index 28f4b8342a..18b22e21f2 100644 --- a/packages/ui/src/memberships/components/MemberListItem/Fields.tsx +++ b/packages/ui/src/memberships/components/MemberListItem/Fields.tsx @@ -10,7 +10,7 @@ export const colLayoutByType = (kind: MemberItemKind) => { const roles = kind !== 'MyMember' ? 136 : 164 const created = 90 const referrer = 50 - const count = kind !== 'MyMember' ? 20 : 76 + const count = 76 const total = 120 switch (kind) { diff --git a/packages/ui/src/memberships/components/MembersSection.tsx b/packages/ui/src/memberships/components/MembersSection.tsx index 624bc03fe5..4177c10ba6 100644 --- a/packages/ui/src/memberships/components/MembersSection.tsx +++ b/packages/ui/src/memberships/components/MembersSection.tsx @@ -80,6 +80,7 @@ const MembershipsGroup = styled.div` 'accountslist'; grid-row-gap: 5px; width: 100%; + overflow: auto; ` const MembershipsHeaders = styled(ListHeaders)` diff --git a/packages/ui/test/setup.ts b/packages/ui/test/setup.ts index a4eb8f6239..29350fa48f 100644 --- a/packages/ui/test/setup.ts +++ b/packages/ui/test/setup.ts @@ -11,6 +11,12 @@ import { AddressToBalanceMap, Balances } from '@/accounts/types' import { BN_ZERO } from '@/common/constants' import { UseModal } from '@/common/providers/modal/types' +Object.defineProperty(global, 'screen', { + value: { + width: 1024, + }, +}) + configure({ testIdAttribute: 'id' }) jest.mock('injectweb3-connect', () => {