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

66 filename rotti per colpa di cloudinary che li cambia #67

Merged
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
3 changes: 2 additions & 1 deletion Scoprimi/public/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ input::placeholder {
.my-input {
padding: 10px;
border-radius: 15px;
background-color: var(--text-color);
color: var(--text-color);
}

.input-question {
color: black !important;
background-color: var(--text-color) !important;
}

.form-floating {
Expand Down
17 changes: 12 additions & 5 deletions Scoprimi/src/components/game/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ import { GameStates, useGameState } from '../../contexts/GameStateContext';
import ImageList from './ImageList';
import { Question, QuestionMode } from '../../../../Server/src/data/Question';

const todoShitFunction = (votestring: string) => {
const wordlList = votestring.substring(votestring.lastIndexOf('/') + 1).split('_').slice(0, -1);
return wordlList?.join(" ");
}
// Funzione per il parsing di filename di immagini
export const todoShitFunction = (votestring: string) => {
const wordlList = votestring.substring(votestring.lastIndexOf('/') + 1).split('_');

// Gestisce nel caso il filename non sia sburato come li rende cloudinary aggiungendo roba a caso dopo il nome. Ex. vedi il file 'fursuit.jpg'
if (wordlList.length === 1) {
return wordlList[0].replace(/\.(.*)$/, '');
}
wordlList.pop();
return wordlList.join(' ');
};

const Game: React.FC = () => {
const [question, setQuestion] = useState<string>('');
Expand Down Expand Up @@ -204,7 +211,7 @@ const Game: React.FC = () => {
alt={todoShitFunction(mostVotedPerson)}
className="winnerImage"
/>}
<p>{todoShitFunction(mostVotedPerson)}</p>
<p>{isPhoto ? todoShitFunction(mostVotedPerson) : mostVotedPerson}</p>
</div>
<div className='elegant-background image-container fill scrollable'>
<Results mostVotedPerson={mostVotedPerson} playerImages={playerImages} voteRecap={voteRecap} isPhoto={isPhoto} />
Expand Down
4 changes: 2 additions & 2 deletions Scoprimi/src/components/game/ImageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const ImageList: React.FC<ImageListProps> = ({ images, onVote, disabled, resetSe
onClick={() => handlePlayerClick(imageUrl)}
style={{
cursor: clicked || disabled ? 'not-allowed' : 'pointer',
opacity: clicked && selectedImage != imageUrl ? 0.5 : 1,
filter: clicked && selectedImage != imageUrl ? 'grayscale(100%)' : 'none' // Applica il bianco e nero se l'immagine è stata cliccata
opacity: clicked && selectedImage !== imageUrl ? 0.5 : 1,
filter: clicked && selectedImage !== imageUrl ? 'grayscale(100%)' : 'none', // Applica il bianco e nero se l'immagine è stata cliccata
}}
/>
))}
Expand Down
7 changes: 1 addition & 6 deletions Scoprimi/src/components/game/Results.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { todoShitFunction } from './Game';

interface ResultsProps {
voteRecap: { [key: string]: string };
Expand All @@ -7,12 +8,6 @@ interface ResultsProps {
isPhoto: boolean;
}

const todoShitFunction = (votestring: string) => {
const wordlList = votestring.substring(votestring.lastIndexOf('/') + 1).split('_').slice(0, -1);
return wordlList?.join(" ");
}



const Results: React.FC<ResultsProps> = ({ voteRecap, playerImages, mostVotedPerson, isPhoto }) => (
<div id="resultsContainer" className="text-center">
Expand Down
4 changes: 3 additions & 1 deletion Scoprimi/src/components/lobby/LobbyPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ const LobbyPlayer: React.FC<PlayerProps> = ({ name, image, isReadyToGame, admin,
{isReadyToGame ? 'Pronto' : 'Non pronto'}
</span>
)}
<div className="tab-icon"></div>
{/*
<div className="tab-icon"></div> A cosa dovrebbe servire sto div???
*/}
</div>
{showDeleteBtn && (
<div className="action-button delete" onClick={handleDelete}>
Expand Down