Changed: Show newly created material groups first and place uncategor -
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m8s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m8s
This commit is contained in:
parent
c3c26718f9
commit
faaccf8a7e
4 changed files with 4 additions and 4 deletions
|
|
@ -250,7 +250,7 @@ export default function FlashcardsPage() {
|
|||
});
|
||||
if (res.ok) {
|
||||
const g = await res.json();
|
||||
setGroups((prev) => [...prev, g]);
|
||||
setGroups((prev) => [g, ...prev]);
|
||||
setIsCreatingGroup(false);
|
||||
setNewGroupName("");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ export default function QuizzesPage() {
|
|||
});
|
||||
if (res.ok) {
|
||||
const g = await res.json();
|
||||
setGroups((prev) => [...prev, g]);
|
||||
setGroups((prev) => [g, ...prev]);
|
||||
setIsCreatingGroup(false);
|
||||
setNewGroupName("");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export async function GET(request: NextRequest) {
|
|||
try {
|
||||
const groups = await prisma.materialGroup.findMany({
|
||||
where: whereClause,
|
||||
orderBy: { sortOrder: "asc" },
|
||||
orderBy: [{ sortOrder: "desc" }, { createdAt: "desc" }],
|
||||
});
|
||||
return NextResponse.json(groups);
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -170,12 +170,12 @@ export function ImportTab({ classId, importType, onImported }: ImportTabProps) {
|
|||
onChange={(e) => setSelectedGroupId(e.target.value)}
|
||||
className="w-full px-3.5 py-2.5 rounded-lg border border-border bg-bg-surface-alt/50 text-text-heading focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary transition-all duration-200"
|
||||
>
|
||||
<option value="">Uncategorized</option>
|
||||
{materialGroups.map((group) => (
|
||||
<option key={group.id} value={group.id}>
|
||||
{group.name}
|
||||
</option>
|
||||
))}
|
||||
<option value="">Uncategorized</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue