Comprehensive UI improvements with proper button spacing and modern design #2
3 changed files with 13 additions and 4 deletions
|
@ -65,9 +65,12 @@ export default function EditStream() {
|
||||||
team_id: streamData.team_id,
|
team_id: streamData.team_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle both old and new API response formats
|
||||||
|
const teams = teamsData.success ? teamsData.data : teamsData;
|
||||||
|
|
||||||
// Map teams for dropdown
|
// Map teams for dropdown
|
||||||
setTeams(
|
setTeams(
|
||||||
teamsData.map((team: Team) => ({
|
teams.map((team: Team) => ({
|
||||||
id: team.team_id,
|
id: team.team_id,
|
||||||
name: team.team_name,
|
name: team.team_name,
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -44,15 +44,19 @@ export default function AddStream() {
|
||||||
const teamsData = await teamsResponse.json();
|
const teamsData = await teamsResponse.json();
|
||||||
const streamsData = await streamsResponse.json();
|
const streamsData = await streamsResponse.json();
|
||||||
|
|
||||||
|
// Handle both old and new API response formats
|
||||||
|
const teams = teamsData.success ? teamsData.data : teamsData;
|
||||||
|
const streams = streamsData.success ? streamsData.data : streamsData;
|
||||||
|
|
||||||
// Map the API data to the format required by the Dropdown
|
// Map the API data to the format required by the Dropdown
|
||||||
setTeams(
|
setTeams(
|
||||||
teamsData.map((team: Team) => ({
|
teams.map((team: Team) => ({
|
||||||
id: team.team_id,
|
id: team.team_id,
|
||||||
name: team.team_name,
|
name: team.team_name,
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|
||||||
setStreams(streamsData);
|
setStreams(streams);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch data:', error);
|
console.error('Failed to fetch data:', error);
|
||||||
showError('Failed to Load Data', 'Could not fetch teams and streams. Please refresh the page.');
|
showError('Failed to Load Data', 'Could not fetch teams and streams. Please refresh the page.');
|
||||||
|
|
|
@ -26,7 +26,9 @@ export default function Teams() {
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/teams');
|
const res = await fetch('/api/teams');
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
setTeams(data);
|
// Handle both old and new API response formats
|
||||||
|
const teams = data.success ? data.data : data;
|
||||||
|
setTeams(teams);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching teams:', error);
|
console.error('Error fetching teams:', error);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue