Skip to content

Commit

Permalink
refactor(flat-pages): refactor pmi link in invitation modal (#2068)
Browse files Browse the repository at this point in the history
  • Loading branch information
syt-honey authored Oct 31, 2023
1 parent fdc0fe3 commit 536c507
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,18 @@

.edit-room-tips {
padding: 8px 16px;
border-radius: 8px;
border-radius: 6px;
background-color: #f6f6f6;
font-size: 12px;

>div {
display: flex;
justify-content: space-between;
padding-top: 8px;
padding-bottom: 8px;
line-height: 24px;
}

>div+div {
margin-top: 8px;
}
}

Expand Down
7 changes: 4 additions & 3 deletions packages/flat-components/src/components/InviteModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface InviteModalProps {
periodicWeeks?: Week[];
onCopy: (text: string) => void;
onCancel: () => void;
pmi?: string | null;
}

export const InviteModal: React.FC<InviteModalProps> = ({
Expand All @@ -27,13 +28,15 @@ export const InviteModal: React.FC<InviteModalProps> = ({
periodicWeeks,
userName,
baseUrl,
pmi,
onCopy,
onCancel,
}) => {
const t = useTranslate();
const language = useLanguage();
const { beginTime, endTime, periodicUUID, roomUUID, inviteCode, title } = room;
const uuid = periodicUUID || roomUUID;
const joinLink = `${baseUrl}/join/${inviteCode === pmi ? inviteCode : uuid}`;

const formattedTimeRange = useMemo<string>(() => {
if (!beginTime || !endTime) {
Expand Down Expand Up @@ -103,9 +106,7 @@ export const InviteModal: React.FC<InviteModalProps> = ({
)}
<div className="invite-modal-content-item">
<span>{t("join-link")}</span>
<span style={{ userSelect: "text" }}>
{baseUrl}/join/{uuid}
</span>
<span style={{ userSelect: "text" }}>{joinLink}</span>
</div>
</div>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useTranslate } from "@netless/flat-i18n";
export interface RoomDetailFooterProps {
room: RoomInfo;
userName: string;
pmi?: string | null;
isCreator: boolean;
isPeriodicDetailsPage: boolean;
inviteBaseUrl: string;
Expand All @@ -27,6 +28,7 @@ export const RoomDetailFooter = /* @__PURE__ */ observer<RoomDetailFooterProps>(
function RoomDetailFooter({
room,
userName,
pmi,
inviteBaseUrl,
isCreator,
isPeriodicDetailsPage,
Expand Down Expand Up @@ -90,6 +92,7 @@ export const RoomDetailFooter = /* @__PURE__ */ observer<RoomDetailFooterProps>(
<InviteModal
baseUrl={inviteBaseUrl}
periodicWeeks={periodicWeeks}
pmi={pmi}
room={room}
userName={userName}
visible={isShowInviteModal}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export const MainRoomList = observer<MainRoomListProps>(function MainRoomList({
<InviteModal
baseUrl={FLAT_WEB_BASE_URL}
periodicWeeks={periodicInfo?.periodic.weeks}
pmi={globalStore.pmi}
room={currentRoom}
userName={globalStore.userName ?? ""}
visible={inviteModalVisible}
Expand Down
1 change: 1 addition & 0 deletions packages/flat-pages/src/RoomDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const RoomDetailPage = observer(function RoomDetailPage() {
isPeriodicDetailsPage={false}
jumpToPeriodicRoomDetailPage={jumpToPeriodicRoomDetailPage}
periodicWeeks={periodicInfo?.periodic.weeks}
pmi={globalStore.pmi}
room={roomInfo}
roomInfo={roomInfo}
showRoomCountVisible={
Expand Down
1 change: 1 addition & 0 deletions packages/flat-pages/src/components/Modal/InviteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const InviteModal = observer<InviteModalProps>(function InviteModal({
<InviteModalImpl
baseUrl={FLAT_WEB_BASE_URL}
periodicWeeks={periodicInfo?.periodic.weeks}
pmi={globalStore.pmi}
room={room}
userName={globalStore.userName ?? ""}
visible={visible}
Expand Down

0 comments on commit 536c507

Please sign in to comment.