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

SH-72 Debug lobby issues #48

Merged
merged 24 commits into from
Apr 10, 2024
Merged
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
9 changes: 7 additions & 2 deletions apps/shelter-client/src/components/ActivityLogs.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '../styles/ActivityLogs.scss';
import { useEffect, useState } from 'react';
import { useEffect, useRef, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { RootState } from '../redux/store';
import { getActivityLogsByLobbyId } from '../api/requests';
@@ -14,6 +14,7 @@ const ActivityLogs = () => {
const user = useSelector((state: RootState) => state.user);
const app = useSelector((state: RootState) => state.app);
const lobby = useSelector((state: RootState) => state.lobby);
const activityLogsRef = useRef<HTMLDivElement>(null);

// LOCAL STATE
const updateState = (newState: Partial<IState>): void =>
@@ -22,6 +23,10 @@ const ActivityLogs = () => {
activityLogs: [],
});

if (activityLogsRef.current) {
activityLogsRef.current.scrollTop = activityLogsRef.current.scrollHeight;
}

useEffect(() => {
handleGetActivityLogs();
}, []);
@@ -39,7 +44,7 @@ const ActivityLogs = () => {
<div className="info-title">
<h3>Activity Logs</h3>
</div>
<div className="activity-logs-wraper">
<div className="activity-logs-wraper" ref={activityLogsRef}>
{state.activityLogs.map((data: { payload: any; createdAt: string }) => {
return (
<div className="activity-logs-block">
2 changes: 2 additions & 0 deletions apps/shelter-client/src/components/Chat.tsx
Original file line number Diff line number Diff line change
@@ -158,6 +158,8 @@ const Chat: FC = () => {
</div>
<div className="input-container">
<input
autoComplete="off"
spellCheck="false"
type="text"
placeholder="Type your message..."
value={state.newMessage}
11 changes: 5 additions & 6 deletions apps/shelter-client/src/components/CustomDropdown.tsx
Original file line number Diff line number Diff line change
@@ -44,22 +44,21 @@ const CustomDropdown: React.FC<DropdownProps> = ({
};
}, [isOpened, onClose, type]);

const isTypeNotifications = type === 'notifications';
return (
<div className={`login-container`} ref={dropdownRef}>
<div className="login-container" ref={dropdownRef}>
{children}
{isOpened && (
<div
className={`drop-down-content ${isTypeNotifications && 'notifications-content'}`}
className={`drop-down-content ${type === 'notifications' && 'notifications-content'}`}
>
{(type === 'account' || type === 'login') && (
<div className={'login-down-text'}>{text}</div>
<div className="login-down-text">{text}</div>
)}
{type === 'notifications' && (
<div className={'notifications-down-text'}>{text}</div>
<div className="notifications-down-text">{text}</div>
)}
{list.map((item, index) => (
<div className={'button-wraper'} key={index}>
<div className="button-wraper" key={index}>
<div className="default-btn-style">
<Button
icon={item.icon}
33 changes: 29 additions & 4 deletions apps/shelter-client/src/components/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -15,8 +15,8 @@ import { getUser } from '../api/requests';
import CustomDropdown from './CustomDropdown';
import useSocketManager from '../hooks/useSocketManager';
import { Listener } from '../websocket/SocketManager';
import { ServerEvents, ServerPayloads } from '../websocket/types';
import { updateLobby } from '../redux/reducers/lobbySlice';
import { ClientEvents, ServerEvents, ServerPayloads } from '../websocket/types';
import { resetLobby, updateLobby } from '../redux/reducers/lobbySlice';
import { Notification, showNotification } from '../libs/notifications';
import { updateApp } from '../redux/reducers/appSlice';
import { faClockRotateLeft } from '@fortawesome/free-solid-svg-icons';
@@ -38,6 +38,7 @@ const Navigation = () => {

const user = useSelector((state: RootState) => state.user);
const app = useSelector((state: RootState) => state.app);
const lobby = useSelector((state: RootState) => state.lobby);

// LOCAL STATE
const updateState = (newState: Partial<IState>): void =>
@@ -65,7 +66,6 @@ const Navigation = () => {
stages: data.stages,
};
dispatch(updateLobby(context));
console.log('ss', context);

// navigate to current room
const route = ROUTES.ROOMS + '/' + data.lobbyId;
@@ -169,13 +169,38 @@ const Navigation = () => {
isActivityLogsOpened: isOpened,
});
};
const handleLogoClick = () => {
const handleLobbyLeave = () => {
sm.emit({
event: ClientEvents.LobbyLeave,
data: {},
});
};
if (lobby.hasStarted && !lobby.hasFinished) {
const result = window.confirm(
'Are you sure you want to leave the game? Any progress will be lost!',
);
if (result) {
dispatch(resetLobby());
handleLobbyLeave();
navigate(ROUTES.MAIN);
return;
} else {
return;
}
} else {
dispatch(resetLobby());
handleLobbyLeave();
navigate(ROUTES.MAIN);
}
};

// Navigation
return (
<div>
<div className="navigation-wrapper">
<div className="navigation-container">
<div className="logo-container" onClick={() => navigate(ROUTES.MAIN)}>
<div className="logo-container" onClick={handleLogoClick}>
<img className="logo-image" src={intoTheShelter} alt={''} />
</div>
{user.userId && (
1 change: 1 addition & 0 deletions apps/shelter-client/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import Cookies from 'js-cookie';
import { ROUTES, CHAR_TYPES } from './constants';

export type charListType = {
stage: any;
type: string;
icon: string;
text: string;
2 changes: 1 addition & 1 deletion apps/shelter-client/src/pages/Main.tsx
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ const MainPage = () => {
sm.emit({
event: ClientEvents.LobbyCreate,
data: {
maxClients: 8, // used as default
maxClients: 4, // used as default
organizatorId: user.userId,
},
});
Loading

Unchanged files with check annotations Beta

def show_camera_feed():
# Initialize MediaPipe face detection and landmark models
mp_face_mesh = mp.solutions.face_mesh
mp_drawing = mp.solutions.drawing_utils

Check failure on line 47 in apps/shelter-ml/filter_2d.py

GitHub Actions / integration-test

Ruff (F841)

apps/shelter-ml/filter_2d.py:47:5: F841 Local variable `mp_drawing` is assigned to but never used
face_mesh = mp_face_mesh.FaceMesh(static_image_mode=False, max_num_faces=1, min_detection_confidence=0.5, min_tracking_confidence=0.5)
# Load the mask image
import utils.background as background
import numpy as np

Check failure on line 9 in apps/shelter-ml/main.py

GitHub Actions / integration-test

Ruff (F401)

apps/shelter-ml/main.py:9:17: F401 `numpy` imported but unused
app = FastAPI()