Skip to content

Commit

Permalink
fix: improvements for program lines (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelmala authored and martinstark committed Jan 28, 2025
1 parent d70a068 commit c40d806
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,42 @@ const ButtonWrapper = styled.div`
`;

const CheckboxWrapper = styled.div`
display: flex;
flex-direction: row;
margin-bottom: 1rem;
margin-top: 1rem;
`;

type ProgramOutputModalProps = {
type AudioFeedModalProps = {
onClose: () => void;
onJoin: () => void;
setIsProgramUser: (value: boolean) => void;
isProgramUser: boolean;
};

export const ProgramOutputModal = ({
export const AudioFeedModal = ({
onClose,
onJoin,
setIsProgramUser,
}: ProgramOutputModalProps) => {
isProgramUser,
}: AudioFeedModalProps) => {
return (
<Modal onClose={onClose}>
<ContentWrapper>
<p>
This is a line for program output. Do you wish to join the line as a
as the program output or as a listener?
This is a line for audio feed. Do you wish to join the line as the
audio feed or as a listener?
</p>
<CheckboxWrapper>
<Checkbox
label="Join as program output"
onChange={(e) => setIsProgramUser(e.target.checked)}
label="Listener"
checked={!isProgramUser}
onChange={() => setIsProgramUser(false)}
/>
<Checkbox
label="Audio feed"
checked={isProgramUser}
onChange={() => setIsProgramUser(true)}
/>
</CheckboxWrapper>
</ContentWrapper>
Expand Down
4 changes: 2 additions & 2 deletions src/components/create-production/create-production.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export const CreateProduction = () => {
render={({ field }) => (
<CheckboxWrapper>
<Checkbox
label="This line will be used for a program output"
label="This line will be used for an audio feed"
checked={field.value || false}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
field.onChange(e.target.checked)
Expand Down Expand Up @@ -263,7 +263,7 @@ export const CreateProduction = () => {
render={({ field: controllerField }) => (
<CheckboxWrapper>
<Checkbox
label="This line will be used for a program output"
label="This line will be used for an audio feed"
checked={controllerField.value || false}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
controllerField.onChange(e.target.checked)
Expand Down
16 changes: 12 additions & 4 deletions src/components/landing-page/join-production.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const FetchErrorMessage = styled.div`
`;

const CheckboxWrapper = styled.div`
display: flex;
flex-direction: row;
margin-bottom: 3rem;
margin-top: 1rem;
`;
Expand Down Expand Up @@ -337,13 +339,19 @@ export const JoinProduction = ({
{isProgramOutputLine && (
<>
<p>
Do you want to join this call as the program output or as a
listener?
This is a line for audio feed. Do you wish to join the line as
the audio feed or as a listener?
</p>
<CheckboxWrapper>
<Checkbox
label="Join as program output"
onChange={(e) => setIsProgramUser(e.target.checked)}
label="Listener"
checked={!isProgramUser}
onChange={() => setIsProgramUser(false)}
/>
<Checkbox
label="Audio feed"
checked={isProgramUser}
onChange={() => setIsProgramUser(true)}
/>
</CheckboxWrapper>
</>
Expand Down
24 changes: 6 additions & 18 deletions src/components/production-line/production-line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,6 @@ const ListWrapper = styled(DisplayContainer)`
padding: 0;
`;

// const StateText = styled.span<{ state: string }>`
// font-weight: 700;
// color: ${({ state }) => {
// switch (state) {
// case "connected":
// return "#7be27b";
// case "failed":
// return "#f96c6c";
// default:
// return "#ddd";
// }
// }};
// `;

const ConnectionErrorWrapper = styled(FlexContainer)`
width: 100vw;
justify-content: center;
Expand All @@ -179,7 +165,7 @@ const ProgramOutputIcon = styled.div`
svg {
fill: #59cbe8;
width: 3.5rem;
width: 2.5rem;
}
`;

Expand All @@ -200,8 +186,10 @@ const SpinnerWrapper = styled.div`
margin-top: 2rem;
`;

const CallWrapper = styled(ProductionItemWrapper)`
const CallWrapper = styled(ProductionItemWrapper)<{ isProgramLine?: boolean }>`
margin: 0 0 2rem 0;
background: ${({ isProgramLine }) =>
isProgramLine ? "rgba(73, 67, 124, 0.2)" : "transparent"};
`;

const CallHeader = styled(HeaderWrapper)``;
Expand Down Expand Up @@ -658,7 +646,7 @@ export const ProductionLine = ({
// TODO detect if browser back button is pressed and run exit();

return (
<CallWrapper>
<CallWrapper isProgramLine={line?.programOutputLine}>
{joinProductionOptions &&
loading &&
(!connectionError ? (
Expand Down Expand Up @@ -738,7 +726,7 @@ export const ProductionLine = ({
{line?.programOutputLine && (
<ProgramOutputIcon>
<TVIcon />
Program Output
Audio feed
</ProgramOutputIcon>
)}
</CallInfo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const ManageProductionButtons: FC<ManageProductionButtonsProps> = (
control={control}
render={({ field: controllerField }) => (
<Checkbox
label="This line will be used for a program output"
label="This line will be used for an audio feed"
checked={controllerField.value || false}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
controllerField.onChange(e.target.checked)
Expand Down
20 changes: 19 additions & 1 deletion src/components/production-list/production-list-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ export const InnerDiv = styled.div`

export const Lineblock = styled.div`
margin-top: 1rem;
background-color: #4d4d4d;
background-color: ${({ isProgramOutput }: { isProgramOutput?: boolean }) =>
isProgramOutput ? "rgb(73, 67, 124)" : "rgb(77, 77, 77)"};
border-radius: 1rem;
padding: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
gap: 0.5rem;
`;

export const LineBlockTexts = styled.div``;
Expand All @@ -95,6 +97,7 @@ export const LineBlockTitle = styled.div`
export const LineBlockTitleWrapper = styled.div`
display: flex;
align-items: center;
gap: 0.5rem;
`;

export const ParticipantExpandBtn = styled.button`
Expand Down Expand Up @@ -188,3 +191,18 @@ export const SpinnerWrapper = styled.div`
width: 2rem;
height: 2rem;
`;

export const IconWrapper = styled.div`
height: 2rem;
width: 2rem;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
svg {
fill: white;
height: 100%;
width: 100%;
}
`;
17 changes: 14 additions & 3 deletions src/components/production-list/production-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useGlobalState } from "../../global-state/context-provider";
import {
ChevronDownIcon,
ChevronUpIcon,
TVIcon,
UserIcon,
UsersIcon,
} from "../../assets/icons/icon";
Expand All @@ -19,6 +20,7 @@ import {
HeaderIcon,
HeaderTexts,
HeaderWrapper,
IconWrapper,
InnerDiv,
Lineblock,
LineBlockParticipant,
Expand All @@ -34,10 +36,10 @@ import {
ProductionName,
SpinnerWrapper,
} from "./production-list-components";
import { ProgramOutputModal } from "../program-output-modal/program-output-modal";
import { ManageProductionButtons } from "./manage-production-buttons";
import { ConfirmationModal } from "../verify-decision/confirmation-modal";
import { TLine } from "../production-line/types";
import { AudioFeedModal } from "../audio-feed-modal/audio-feed-modal";

type ProductionsListItemProps = {
production: TBasicProductionResponse;
Expand Down Expand Up @@ -152,9 +154,17 @@ export const ProductionsListItem = ({
<ProductionLines className={open ? "expanded" : ""}>
<InnerDiv>
{production.lines?.map((l) => (
<Lineblock key={`line-${l.id}-${l.name}`}>
<Lineblock
key={`line-${l.id}-${l.name}`}
isProgramOutput={l.programOutputLine}
>
<LineBlockTexts>
<LineBlockTitleWrapper>
{l.programOutputLine && (
<IconWrapper>
<TVIcon />
</IconWrapper>
)}
<LineBlockTitle>{l.name}</LineBlockTitle>
{l.participants.length > 4 && (
<ParticipantExpandBtn
Expand Down Expand Up @@ -222,13 +232,14 @@ export const ProductionsListItem = ({
</SecondaryButton>
)}
{isModalOpen && modalLineId && (
<ProgramOutputModal
<AudioFeedModal
onClose={() => setIsModalOpen(false)}
onJoin={() => {
setIsModalOpen(false);
goToProduction(modalLineId);
}}
setIsProgramUser={setIsProgramUser}
isProgramUser={isProgramUser}
/>
)}
</Lineblock>
Expand Down

0 comments on commit c40d806

Please sign in to comment.