Skip to content
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
4 changes: 2 additions & 2 deletions frontend/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import type {
SuccessResponseDTO,
TeamDTO,
TeamResponseDTO,
TeamUpdateDTO,
UserDTO,
UserListDto,
} from "./types/dto";
Expand Down Expand Up @@ -272,7 +273,7 @@ export class ApiClient {
* @param team.teamImg The team's image
* @param team.owner The team's owner
*/
public async updateTeam(team: TeamDTO): Promise<void> {
public async updateTeam(team: TeamUpdateDTO): Promise<void> {
await this.put<ApplicationControllerMethods["updateTeam"]>(
"/application/team",
team,
Expand Down Expand Up @@ -314,7 +315,6 @@ export class ApiClient {
): Promise<void> {
await this.delete<ApplicationControllerMethods["removeUserFromTeam"]>(
`/application/team/${teamId}/members/${userId}`,
{} as never,
);
}

Expand Down
9 changes: 7 additions & 2 deletions frontend/src/components/base/stack-with-border.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import * as React from "react";
import { Stack, Tooltip } from "@mui/material";

// TODO types. text and tooltip are optional
interface StackWithBorderProps {
text?: string;
tooltip?: string;
children?: React.ReactNode;
}

/**
* I typically use this to display some text and a few buttons,
* with multiple of this on top of each other, like a table.
* Maybe these components should use tables instead, idk. It looks nice.
*/
export const StackWithBorder = ({ text, children, tooltip }) => {
export const StackWithBorder = ({ text, children, tooltip }: StackWithBorderProps) => {
return (
<div
style={{
Expand Down
22 changes: 17 additions & 5 deletions frontend/src/components/pages/edit-team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { RoundedImage } from "../base/image";
import { Spacer } from "../base/flex";
import { TextInput, TextInputType } from "../base/text-input";
import { api, useApi } from "../../hooks/use-api";
import { Card, CardContent, TextField, Stack } from "@mui/material";
import { Card, CardContent } from "@mui/material";
import { UserListDto, TeamResponseDTO } from "../../api/types/dto";
import { useLoginContext } from "../../contexts/login-context";
import { useHistory } from "react-router-dom";
Expand All @@ -16,11 +16,17 @@ import { PageHeader } from "../base/page-header";
import { useNotificationContext } from "../../contexts/notification-context";
import { StackWithBorder } from "../base/stack-with-border";

interface TeamMemberRequestProps {
user: UserListDto;
updateTeamInProgress: boolean;
acceptUserToTeam: (user: UserListDto) => void;
}

const TeamMemberRequest = ({
user,
updateTeamInProgress,
acceptUserToTeam,
}) => {
}: TeamMemberRequestProps) => {
return (
<StackWithBorder text={user.firstName}>
<Button
Expand All @@ -38,14 +44,21 @@ const TeamMemberRequest = ({
);
};

// TODO types
interface TeamMemberProps {
team: TeamResponseDTO;
user: UserListDto;
updateTeamInProgress: boolean;
onSetOwner: (user: UserListDto) => void;
onRemove: (user: UserListDto) => void;
}

const TeamMember = ({
team,
user,
updateTeamInProgress,
onSetOwner,
onRemove,
}) => {
}: TeamMemberProps) => {
const { user: loginStateUser } = useLoginContext();
const loggedInAsAdmin = loginStateUser?.role === UserRole.Root;
const loggedInAsOwner = loginStateUser?.id === team.owner?.id;
Expand Down Expand Up @@ -129,7 +142,6 @@ export const EditTeam = ({ team }: { team: TeamResponseDTO }) => {
async (apiClient, wasTriggeredManually) => {
if (wasTriggeredManually) {
await apiClient.updateTeam({
...team,
id: team.id,
title,
description,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/pages/rating-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
RadioGroup,
FormControlLabel,
Radio,
Tooltip,
} from "@mui/material";
import { api } from "../../hooks/use-api";
import { useLoginContext } from "../../contexts/login-context";
Expand Down