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

FIRE-781 add login modal when not login #280

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions src/components/main/TitleContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import styled from 'styled-components';
import media from 'src/styles/media';
import toast from 'react-hot-toast';
import mainModalStore from 'src/stores/mainModalStore';
import vectors from '../atoms/Vectors';
import Search from './Search';
import PositionInterface from '../../interface/position.interface';

export default function TitleContainer() {
const { openLoginModal } = mainModalStore();
const randomEnter = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
toast.error('로그인 후 입장 가능합니다.');
openLoginModal();
};

return (
Expand Down
4 changes: 3 additions & 1 deletion src/components/main/block/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useNavigate } from 'react-router-dom';
import { isMobile } from 'react-device-detect';
import styled from 'styled-components';
import media from 'src/styles/media';
import mainModalStore from 'src/stores/mainModalStore';
import UserStore from '../../../stores/userStore';
import MyAvatar from '../../../assets/avatar/MyAvatar';
import RoomDetail from '../../atoms/RoomDetail';
Expand All @@ -14,11 +15,12 @@ export default function Block({ isMain, data }) {
const navigate = useNavigate();
const { nickname } = UserStore();
const { enterProfile } = useEnterProfile(data?.moderator.uid);
const { openLoginModal } = mainModalStore();

const enterRoom = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
if (!nickname) {
toast.error('로그인이 필요합니다');
openLoginModal();
return;
}
if (isMobile) {
Expand Down