Skip to content

Commit 61f747c

Browse files
author
longld
committed
Merge branch 'dev' of https://github.com/TranHoan2004/LabVerse into fix/fix-annotation
2 parents a40203e + c73ddea commit 61f747c

14 files changed

Lines changed: 97 additions & 437 deletions

File tree

services/paper-service/src/main/kotlin/com/se1853_jv/controller/PaperController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class PaperController(
9797
@RequestParam authors: String,
9898
@RequestParam journal: String,
9999
@RequestParam publicationYear: Int,
100-
@RequestParam doi: String,
100+
@RequestParam(required = false) doi: String,
101101
@RequestParam(required = false) description: String?,
102102
@RequestParam(required = false) keywords: String?,
103103
@RequestParam(required = false) tags: String?,

web/src/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import { BrowserRouter, Routes, Route } from "react-router-dom";
66
import { AuthProvider } from "@/contexts/AuthContext";
77
import { ProtectedRoute } from "@/components/ProtectedRoute";
88
import Index from "./pages/Index";
9-
import Auth from "./pages/Auth";
109
import Dashboard from "./pages/dashboard/Dashboard";
1110
import PaperDetail from "./pages/paper/PaperDetail";
12-
import Collections from "./pages/Collections";
13-
import CollectionDetails from "./pages/CollectionDetails";
1411
import Profile from "./pages/profile/Profile";
1512
import Discover from "./pages/Discover";
16-
import ReadingLists from "./pages/ReadingLists";
17-
import Teams from "./pages/Teams";
1813
import NotFound from "./components/NotFound";
14+
import Teams from "./pages/team/Teams";
15+
import ReadingLists from "./pages/reading-list/ReadingLists";
16+
import Collections from "./pages/collection/Collections";
17+
import Auth from "./pages/auth/Auth";
18+
import CollectionDetails from "./pages/collection/CollectionDetails";
1919

2020
const queryClient = new QueryClient();
2121

web/src/pages/Collections.tsx

Lines changed: 0 additions & 352 deletions
This file was deleted.

web/src/pages/Teams.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import {
1717
getTeams,
1818
createTeam,
1919
deleteTeam,
20-
type TeamResponse
2120
} from "@/services/team.service";
2221
import {
2322
DropdownMenu,
2423
DropdownMenuContent,
2524
DropdownMenuItem,
2625
DropdownMenuTrigger,
2726
} from "@/components/ui/dropdown-menu";
27+
import { TeamResponse } from "@/types/team.types";
2828

2929
const Teams = () => {
3030
const {user} = useAuth();
@@ -231,17 +231,17 @@ const Teams = () => {
231231
/>
232232
</div>
233233
<Select
234-
value={privacyFilter}
235-
onValueChange={(value: 'PUBLIC' | 'PRIVATE' | '') => {
236-
setPrivacyFilter(value);
234+
value={privacyFilter === '' ? 'ALL' : privacyFilter}
235+
onValueChange={(value: string) => {
236+
setPrivacyFilter(value === 'ALL' ? '' : (value as 'PUBLIC' | 'PRIVATE'));
237237
setPage(0);
238238
}}
239239
>
240240
<SelectTrigger className="w-full sm:w-[180px]">
241241
<SelectValue placeholder="All teams"/>
242242
</SelectTrigger>
243243
<SelectContent>
244-
<SelectItem value="">All teams</SelectItem>
244+
<SelectItem value="ALL">All teams</SelectItem>
245245
<SelectItem value="PUBLIC">Public</SelectItem>
246246
<SelectItem value="PRIVATE">Private</SelectItem>
247247
</SelectContent>
File renamed without changes.

web/src/pages/dashboard/Dashboard.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ import { getPaginatedPapers, importPaper, getFavoritePapers } from "@/services/p
1111
import Header from "@/components/Header";
1212
import DashboardHeader from "./components/DashboardHeader";
1313
import SearchAndFilter from "./components/SearchAndFilter";
14-
import { CreatePaperRequest } from "@/types/paper.type";
14+
import { CreatePaperRequest } from "@/types/paper.types";
1515
import { getWorkflowsByUser } from "@/services/progress.service";
1616
import { getPaperDetails } from "@/services/paper.service.ts";
1717
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
18+
import { supabase } from "@/integrations/supabase/client";
19+
20+
1821
const Dashboard = () => {
1922
const { user } = useAuth();
2023
const queryClient = useQueryClient();
@@ -54,7 +57,7 @@ const Dashboard = () => {
5457
// Apply search filter if provided
5558
if (searchQuery) {
5659
const searchLower = searchQuery.toLowerCase();
57-
favorites = favorites.filter((paper: any) =>
60+
favorites = favorites.filter((paper) =>
5861
paper.title?.toLowerCase().includes(searchLower) ||
5962
paper.authors?.toLowerCase().includes(searchLower) ||
6063
paper.journal?.toLowerCase().includes(searchLower)
@@ -63,22 +66,22 @@ const Dashboard = () => {
6366

6467
// Apply filters
6568
if (filters.author) {
66-
favorites = favorites.filter((paper: any) =>
69+
favorites = favorites.filter((paper) =>
6770
paper.authors?.toLowerCase().includes(filters.author.toLowerCase())
6871
);
6972
}
7073
if (filters.journal) {
71-
favorites = favorites.filter((paper: any) =>
74+
favorites = favorites.filter((paper) =>
7275
paper.journal?.toLowerCase().includes(filters.journal.toLowerCase())
7376
);
7477
}
7578
if (filters.yearFrom) {
76-
favorites = favorites.filter((paper: any) =>
79+
favorites = favorites.filter((paper) =>
7780
paper.publicationYear >= parseInt(filters.yearFrom)
7881
);
7982
}
8083
if (filters.yearTo) {
81-
favorites = favorites.filter((paper: any) =>
84+
favorites = favorites.filter((paper) =>
8285
paper.publicationYear <= parseInt(filters.yearTo)
8386
);
8487
}

web/src/pages/team/Teams.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import {
1212
getTeams,
1313
createTeam,
1414
deleteTeam,
15-
type TeamResponse
1615
} from "@/services/team.service";
1716
import CreateTeamDialog from "./components/CreateTeamDialog";
1817
import TeamsSearchFilter from "./components/TeamsSearchFilter";
1918
import TeamsGrid from "./components/TeamsGrid";
2019
import PaginationControls from "./components/PaginationControls";
20+
import { TeamResponse } from "@/types/team.types";
2121

2222
const Teams = () => {
2323
const {user} = useAuth();
@@ -48,7 +48,9 @@ const Teams = () => {
4848
},
4949
});
5050

51-
const teams = teamsData?.content || [];
51+
// teams can be null when the API returns no content field or the resource is missing
52+
// keep null distinct from empty array so we can show a "data not found" message
53+
const teams: TeamResponse[] | null = teamsData?.content ?? null;
5254
const totalPages = teamsData?.totalPages || 0;
5355

5456
const createMutation = useMutation({
@@ -177,6 +179,14 @@ const Teams = () => {
177179
<div className="flex justify-center py-12">
178180
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-primary"></div>
179181
</div>
182+
) : teams === null ? (
183+
<Card className="text-center py-12">
184+
<CardContent>
185+
<Users className="h-12 w-12 mx-auto mb-4 text-muted-foreground"/>
186+
<h3 className="text-lg font-semibold mb-2">Data not found</h3>
187+
<p className="text-muted-foreground mb-4">The requested teams data does not exist.</p>
188+
</CardContent>
189+
</Card>
180190
) : teams.length > 0 ? (
181191
<>
182192
<TeamsGrid

web/src/pages/team/components/TeamCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
DropdownMenuItem,
99
DropdownMenuTrigger,
1010
} from '@/components/ui/dropdown-menu';
11-
import type { TeamResponse } from '@/services/team.service';
11+
import { TeamResponse } from '@/types/team.types';
1212

1313
type Props = {
1414
team: TeamResponse;

web/src/pages/team/components/TeamsGrid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {Card, CardContent} from '@/components/ui/card';
33
import {Button} from '@/components/ui/button';
44
import {Plus, Users} from 'lucide-react';
55
import TeamCard from './TeamCard';
6-
import type { TeamResponse } from '@/services/team.service';
6+
import { TeamResponse } from '@/types/team.types';
77

88
type Props = {
99
teams: TeamResponse[];

web/src/pages/team/components/TeamsSearchFilter.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ const TeamsSearchFilter: React.FC<Props> = ({
2828
/>
2929
</div>
3030
<Select
31-
value={privacyFilter}
32-
onValueChange={(value: 'PUBLIC' | 'PRIVATE' | '') => onPrivacyFilterChange(value)}
31+
value={privacyFilter === '' ? 'ALL' : privacyFilter}
32+
onValueChange={(value: string) => onPrivacyFilterChange(value === 'ALL' ? '' : (value as 'PUBLIC' | 'PRIVATE'))}
3333
>
3434
<SelectTrigger className="w-full sm:w-[180px]">
3535
<SelectValue placeholder="All teams"/>
3636
</SelectTrigger>
3737
<SelectContent>
38-
<SelectItem value="">All teams</SelectItem>
38+
<SelectItem value="ALL">All teams</SelectItem>
3939
<SelectItem value="PUBLIC">Public</SelectItem>
4040
<SelectItem value="PRIVATE">Private</SelectItem>
4141
</SelectContent>

0 commit comments

Comments
 (0)