Skip to content

Commit

Permalink
fix: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
CzarekDryl committed Jan 22, 2025
1 parent a1b354d commit daf434d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { TourTargets } from '~common/Tours/enums.ts';
import { DEFAULT_NETWORK_INFO } from '~constants';
import { useActionSidebarContext } from '~context/ActionSidebarContext/ActionSidebarContext.ts';
import { useAppContext } from '~context/AppContext/AppContext.ts';
import { useColonyContext } from '~context/ColonyContext/ColonyContext.ts';
import { usePageLayoutContext } from '~context/PageLayoutContext/PageLayoutContext.ts';
import { useMobile } from '~hooks/index.ts';
import useDisableBodyScroll from '~hooks/useDisableBodyScroll/index.ts';
Expand Down Expand Up @@ -38,7 +39,6 @@ const UserNavigation: FC<UserNavigationProps> = ({
extra = null,
userHub,
txButton = null,
isInColony,
}) => {
const { wallet, connectWallet, user } = useAppContext();
const isMobile = useMobile();
Expand All @@ -51,6 +51,9 @@ const UserNavigation: FC<UserNavigationProps> = ({
useState(false);
const [isActionSidebarOpen] = actionSidebarToggle;

const colonyContext = useColonyContext({ nullableContext: true });
const isInColony = !!colonyContext;

const isWalletConnected = !!wallet?.address;
const networkInfo = useGetCurrentNetwork();

Expand Down Expand Up @@ -98,7 +101,7 @@ const UserNavigation: FC<UserNavigationProps> = ({
iconSize={16}
size="small"
isFullRounded
className="gap-1 px-[0.875rem] sm:px-2.5 md:hover:!border-blue-400"
className="gap-1 px-3.5 sm:px-2.5 md:hover:!border-blue-400"
onClick={() => setIsInviteMembersModalOpen(true)}
/>
) : null}
Expand Down
1 change: 0 additions & 1 deletion src/components/common/Extensions/UserNavigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export interface UserNavigationProps {
extra?: ReactNode;
userHub: ReactNode;
txButton?: ReactNode;
isInColony?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const UserNavigationWrapper: FC<UserNavigationWrapperProps> = ({
extra,
isHidden,
className,
isInColony,
}) => {
const userHubComponent = userHub || <HeaderAvatar />;
const userNavigation = (
Expand All @@ -24,7 +23,6 @@ const UserNavigationWrapper: FC<UserNavigationWrapperProps> = ({
txButton={txButton}
userHub={userHubComponent}
extra={extra}
isInColony={isInColony}
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ export interface UserNavigationWrapperProps {
extra?: ReactNode;
isHidden?: boolean;
className?: string;
isInColony?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const MSG = defineMessages({
modalDescription: {
id: `${displayName}.modalDescription`,
defaultMessage:
'You can invite {invitesAvailable} more people to join and follow this colony during early access. If you run out, you will be able to request more.',
'You can invite {invitesAvailable} more {invitesAvailable, plural, one {person} other {people}} to join and follow this colony during early access. If you run out, you will be able to request more.',
},
modalDescriptionReached: {
id: `${displayName}.modalDescriptionReached`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const MSG = defineMessages({
modalDescription: {
id: `${displayName}.modalDescription`,
defaultMessage:
'You can invite {invitesAvailable} more people to join and follow this colony during early access. If you run out, you will be able to request more.',
'You can invite {invitesAvailable} more {invitesAvailable, plural, one {person} other {people}} to join and follow this colony during early access. If you run out, you will be able to request more.',
},
modalDescriptionReached: {
id: `${displayName}.modalDescriptionReached`,
Expand Down Expand Up @@ -64,6 +64,8 @@ const MSG = defineMessages({
},
});

const commonClassName = 'rounded-lg p-2 text-sm font-medium';

export const ModalContent: FC<Props> = ({
isOutOfInvites,
invitesAvailable,
Expand All @@ -76,7 +78,6 @@ export const ModalContent: FC<Props> = ({
const inviteLink = useBaseUrl(
`/invite/${colonyName}/${colonyMemberInvite?.id}`,
);
const commonClassName = 'rounded-lg p-2 text-sm font-medium';

if (isOutOfInvites) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ const PageHeader: FC<PageHeaderProps> = () => {
) : null
}
extra={colonyContext ? <JoinButton /> : null}
isInColony={!!colonyContext}
className={clsx(
'modal-blur-navigation [.show-header-in-modal_&]:z-userNavModal',
{
Expand Down

0 comments on commit daf434d

Please sign in to comment.