Skip to content

Commit

Permalink
Random id no room, fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vtnorton committed Sep 2, 2024
1 parent 6eee2d1 commit 3eec9ce
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const DASHBOARD_GROUP_ID = process.env.NEXT_PUBLIC_DASHBOARD_GROUP_ID as string
const DASHBOARD_GROUP_NAME = process.env.NEXT_PUBLIC_DASHBOARD_GROUP_NAME as string
const DASHBOARD_PARTICIPANT_ID = process.env.NEXT_PUBLIC_DASHBOARD_PARTICIPANT_ID as string
const DASHBOARD_PARTICIPANT_NAME = process.env.NEXT_PUBLIC_DASHBOARD_PARTICIPANT_NAME as string
const DASHBOARD_ROOM_ID = process.env.NEXT_PUBLIC_DASHBOARD_ROOM_ID as string

const DASHBOARD_ROOM_ID = (process.env.NEXT_PUBLIC_DASHBOARD_ROOM_ID as string) + '-' + Math.random().toString(36).substring(7)

export default function Dashboard() {

Expand Down
2 changes: 1 addition & 1 deletion src/app/userPage/UserPageContent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import User, {MobileUser} from "@/components/User";
import { MobileUser } from "@/components/User";
import { ActivationColor, activations } from "@/data/activationsData";
import CardLink from "@/components/CardLink";
import React from "react";
Expand Down
36 changes: 18 additions & 18 deletions src/components/User/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";
import {IUser, IUserActivation} from "../../../types";
import {ActivationColor} from "@/data/activationsData";
import {ActivationType} from "@/global/global.types";
import { IUser, IUserActivation } from "../../../types";
import { ActivationColor } from "@/data/activationsData";
import { ActivationType } from "@/global/global.types";
import "./user.scss"

export function TVUser({ user } : { user: IUser}) {
export function TVUser({ user }: { user: IUser }) {
const firstLetter = user.name.at(0) ?? 'U'
const activationsNumber = user.activations.length
const userHasStar = activationsNumber === Object.keys(ActivationColor).length && user.activations.every(activation => activation.completed)
Expand All @@ -13,7 +13,7 @@ export function TVUser({ user } : { user: IUser}) {
<div className={`flex flex-col items-center justify-center`} >
{userHasStar && <p className="mb-1 tv:text-[1.75rem]">⭐️</p>}
<div className={`relative w-[12.125rem] h-[12.125rem]`}>
<TVActivations userActivations={user.activations}/>
<TVActivations userActivations={user.activations} />
<div
className="baseUser">
<span className="text-[#26242A] text-lg tv:text-[2.25rem] font-black">{firstLetter.toUpperCase()}</span>
Expand All @@ -24,17 +24,17 @@ export function TVUser({ user } : { user: IUser}) {
)
}

function TVActivations({userActivations}: { userActivations: IUserActivation[] }) {
function TVActivations({ userActivations }: { userActivations: IUserActivation[] }) {
const ringClasses = (index: number) => {
if(!userActivations[index]) {
if (!userActivations[index]) {
return ''
}

if(userActivations[index].name === ActivationType.GAME) {
if (userActivations[index].name === ActivationType.GAME) {
return `GAME GAME-${userActivations[index].quantity || 1}`
}

if(userActivations[index].completed) {
if (userActivations[index].completed) {
return `${userActivations[index].name} completed`
}

Expand All @@ -51,7 +51,7 @@ function TVActivations({userActivations}: { userActivations: IUserActivation[] }
)
}

export function MobileUser({ user} : { user: IUser}) {
export function MobileUser({ user }: { user: IUser }) {
const firstLetter = user.name.at(0) ?? 'U'
const activationsNumber = user.activations.length
const userHasStar = activationsNumber === Object.keys(ActivationColor).length && user.activations.every(activation => activation.completed)
Expand All @@ -60,7 +60,7 @@ export function MobileUser({ user} : { user: IUser}) {
<div className={`flex flex-col items-center justify-center`} >
{userHasStar && <p className="mb-1 tv:text-[1.75rem]">⭐️</p>}
<div className={`relative w-[6.5rem] h-[6.5rem]`}>
<MobileActivations userActivations={user.activations}/>
<MobileActivations userActivations={user.activations} />
<div
className="baseUser">
<span className="text-[#26242A] text-lg tv:text-[2.25rem] font-black">{firstLetter.toUpperCase()}</span>
Expand All @@ -71,23 +71,23 @@ export function MobileUser({ user} : { user: IUser}) {
)
}

function MobileActivations({userActivations}: { userActivations: IUserActivation[] }) {
function MobileActivations({ userActivations }: { userActivations: IUserActivation[] }) {
const ringClasses = (index: number) => {
if(!userActivations[index]) {
if (!userActivations[index]) {
return ''
}
if(userActivations[index].name === ActivationType.GAME) {

if (userActivations[index].name === ActivationType.GAME) {
return `GAME GAME-${userActivations[index].quantity || 1}`
}
if(userActivations[index].completed) {

if (userActivations[index].completed) {
return `${userActivations[index].name} completed`
}

return `${userActivations[index].name} incomplete`
}

return (
<>
<div className={`firstRing ${ringClasses(0)}`}></div>
Expand Down

0 comments on commit 3eec9ce

Please sign in to comment.