Skip to content

Commit

Permalink
fix/ create team5
Browse files Browse the repository at this point in the history
  • Loading branch information
k0t1k777 committed Aug 18, 2024
1 parent 1bd8889 commit 8795399
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/pages/Projects/Projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import {
export default function Projects() {
const dispatch = useAppDispatch();
const { projects } = useAppSelector(selectProjects);
console.log('projects: ', projects);



useEffect(() => {
dispatch(fetchGetProjects());
}, []);
Expand Down
5 changes: 2 additions & 3 deletions src/pages/Teams/Teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ import { selectUsers, setLoading } from 'src/store/features/slice/userSlice';
import TeamsItemPersonal from 'src/ui/TeamsItem/TeamsItemPersonal';

export default function Teams() {
const { id } = useParams();
const { teams, team, addTeam } = useAppSelector(selectTeams);
let { loading } = useAppSelector(selectUsers);
const dispatch = useAppDispatch();
const { id } = useParams();
const { teams, team, addTeam } = useAppSelector(selectTeams);
const [allCards, setAllCards] = useState<membersProps[]>([]);
const [updatedCards, setUpdatedCards] = useState<membersProps[]>([]);
const [teamCard, setTeamCard] = useState<membersProps[]>([]);
// const teamsRout = location.pathname === '/teams';
// console.log('teamsRout: ', teamsRout);
console.log('addTeam: ', addTeam);

const collectCellIds = (card: membersProps, collected: string[]) => {
if (card.cellId) {
Expand Down
7 changes: 6 additions & 1 deletion src/store/features/slice/teamsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface StateType {
error: string | null | unknown;
nameTeam: string;
addTeam: TeamsProps[];
selectedTeam: null,
}

const initialState: StateType = {
Expand All @@ -20,6 +21,7 @@ const initialState: StateType = {
error: null,
nameTeam: '',
addTeam: [],
selectedTeam: null,
};

export const fetchGetTeams = createAsyncThunk(
Expand Down Expand Up @@ -48,6 +50,9 @@ const teamsSlice = createSlice({
setAddTeam(state, action) {
state.addTeam = action.payload;
},
setSelectedTeam(state, action) {
state.selectedTeam = action.payload;
},
},
extraReducers: (builder) => {
builder
Expand Down Expand Up @@ -78,6 +83,6 @@ const teamsSlice = createSlice({
},
});

export const { setNameTeam, setAddTeam } = teamsSlice.actions;
export const { setNameTeam, setAddTeam, setSelectedTeam } = teamsSlice.actions;
export const teamsReducer = teamsSlice.reducer;
export const selectTeams = (state: RootStore) => state.teams;
3 changes: 2 additions & 1 deletion src/ui/Preloader/Preloader.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
left: 0;
width: 100%;
height: 100%;
background-color: $main-text-grey;
z-index: 5;
background-color: rgba(240, 240, 240, 0.5);
backdrop-filter: blur(12px);
}

&__loader {
Expand Down
26 changes: 20 additions & 6 deletions src/ui/ProjectsItem/ProjectsItem.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
import styles from 'src/ui/ProjectsItem/ProjectsItem.module.scss';
import { ProjectseProps } from 'src/services/types';
import { useNavigate } from 'react-router-dom';

export default function ProjectsItem({ name, teams }: ProjectseProps) {
const navigate = useNavigate();

const handleTeamClick = (teamId: number) => {
navigate(`/teams/${teamId}`);
};

return (
<div className={styles.projectsItem}>
<p className={styles.title}>{name}</p>
<div className={styles.mainContainer}>
{teams &&
teams.map((item) => (
<p key={item.id} className={`${styles.text} ${styles.text_link}`}>
{item.name}
</p>
))}
{teams &&
teams.map((item) => {
const teamId = item.id ? Number(item.id) : undefined;
return (
<p
key={item.id}
onClick={() => teamId !== undefined && handleTeamClick(teamId)}
className={`${styles.text} ${styles.text_link}`}
>
{item.name}
</p>
);
})}
<p className={styles.text}>
Опорное месторождение Ямальского центра газодобычи
</p>
Expand Down

0 comments on commit 8795399

Please sign in to comment.