Compare commits
1 Commits
main
...
cd6cb72d4c
| Author | SHA1 | Date | |
|---|---|---|---|
| cd6cb72d4c |
@@ -59,7 +59,7 @@ const mapLineasToLineaCurricular = (
|
|||||||
id: linea.id,
|
id: linea.id,
|
||||||
nombre: linea.nombre,
|
nombre: linea.nombre,
|
||||||
orden: linea.orden ?? 0,
|
orden: linea.orden ?? 0,
|
||||||
color: palette[index % palette.length],
|
color: linea.color ?? palette[index % palette.length],
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ function AsignaturaCardItem({
|
|||||||
onDragStart={(e) => onDragStart(e, asignatura.id)}
|
onDragStart={(e) => onDragStart(e, asignatura.id)}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
className={[
|
className={[
|
||||||
'group relative h-50 w-40 shrink-0 overflow-hidden rounded-[22px] border text-left',
|
'group bg-background relative h-50 w-40 shrink-0 overflow-hidden rounded-[22px] border text-left',
|
||||||
'transition-all duration-300 ease-out',
|
'transition-all duration-300 ease-out',
|
||||||
'focus-visible:ring-ring/30 focus-visible:ring-2 focus-visible:outline-none',
|
'focus-visible:ring-ring/30 focus-visible:ring-2 focus-visible:outline-none',
|
||||||
'cursor-grab active:cursor-grabbing',
|
'cursor-grab active:cursor-grabbing',
|
||||||
@@ -194,26 +194,10 @@ function AsignaturaCardItem({
|
|||||||
: 'hover:-translate-y-1 hover:shadow-lg',
|
: 'hover:-translate-y-1 hover:shadow-lg',
|
||||||
].join(' ')}
|
].join(' ')}
|
||||||
style={{
|
style={{
|
||||||
borderColor: hexToRgba(lineaColor, 0.18),
|
borderColor: lineaColor,
|
||||||
background: `
|
|
||||||
radial-gradient(circle at top right, ${hexToRgba(lineaColor, 0.22)} 0%, transparent 34%),
|
|
||||||
linear-gradient(180deg, ${hexToRgba(lineaColor, 0.12)} 0%, ${hexToRgba(lineaColor, 0.04)} 42%, var(--card) 100%)
|
|
||||||
`,
|
|
||||||
}}
|
}}
|
||||||
title={asignatura.nombre}
|
title={asignatura.nombre}
|
||||||
>
|
>
|
||||||
{/* franja */}
|
|
||||||
<div
|
|
||||||
className="absolute inset-x-0 top-0 h-2"
|
|
||||||
style={{ backgroundColor: lineaColor }}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* glow decorativo */}
|
|
||||||
<div
|
|
||||||
className="absolute -top-10 -right-10 h-28 w-28 rounded-full blur-2xl"
|
|
||||||
style={{ backgroundColor: hexToRgba(lineaColor, 0.22) }}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className="relative flex h-full flex-col p-4">
|
<div className="relative flex h-full flex-col p-4">
|
||||||
{/* top */}
|
{/* top */}
|
||||||
<div className="flex items-start justify-between gap-2">
|
<div className="flex items-start justify-between gap-2">
|
||||||
@@ -248,7 +232,7 @@ function AsignaturaCardItem({
|
|||||||
{/* titulo */}
|
{/* titulo */}
|
||||||
<div className="mt-4 min-h-18">
|
<div className="mt-4 min-h-18">
|
||||||
<h3
|
<h3
|
||||||
className="text-foreground overflow-hidden text-sm leading-[1.08]"
|
className="text-foreground overflow-hidden pb-1 text-sm leading-[1.08]"
|
||||||
style={{
|
style={{
|
||||||
display: '-webkit-box',
|
display: '-webkit-box',
|
||||||
WebkitLineClamp: 3,
|
WebkitLineClamp: 3,
|
||||||
@@ -261,7 +245,7 @@ function AsignaturaCardItem({
|
|||||||
|
|
||||||
{/* bottom */}
|
{/* bottom */}
|
||||||
<div className="mt-auto grid grid-cols-3 gap-2">
|
<div className="mt-auto grid grid-cols-3 gap-2">
|
||||||
<div className="flex flex-col items-center rounded-2xl border border-white/40 bg-white/55 px-2.5 py-2 backdrop-blur-sm dark:border-white/10 dark:bg-white/5">
|
<div className="bg-muted/70 border-border/70 flex flex-col items-center rounded-2xl border px-2.5 py-2">
|
||||||
{/* <Icons.Award className="h-3.5 w-3.5" /> */}
|
{/* <Icons.Award className="h-3.5 w-3.5" /> */}
|
||||||
<span className="text-muted-foreground mb-1 text-[10px] font-medium tracking-wide uppercase">
|
<span className="text-muted-foreground mb-1 text-[10px] font-medium tracking-wide uppercase">
|
||||||
CR
|
CR
|
||||||
@@ -272,7 +256,7 @@ function AsignaturaCardItem({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col items-center rounded-2xl border border-white/40 bg-white/55 px-2.5 py-2 backdrop-blur-sm dark:border-white/10 dark:bg-white/5">
|
<div className="bg-muted/70 border-border/70 flex flex-col items-center rounded-2xl border px-2.5 py-2">
|
||||||
<span className="text-muted-foreground mb-1 text-[10px] font-medium tracking-wide uppercase">
|
<span className="text-muted-foreground mb-1 text-[10px] font-medium tracking-wide uppercase">
|
||||||
HD
|
HD
|
||||||
</span>
|
</span>
|
||||||
@@ -282,7 +266,7 @@ function AsignaturaCardItem({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col items-center border border-white/40 bg-white/55 px-2.5 py-2 backdrop-blur-sm not-last:rounded-2xl dark:border-white/10 dark:bg-white/5">
|
<div className="bg-muted/70 border-border/70 flex flex-col items-center rounded-2xl border px-2.5 py-2">
|
||||||
<span className="text-muted-foreground mb-1 text-[10px] font-medium tracking-wide uppercase">
|
<span className="text-muted-foreground mb-1 text-[10px] font-medium tracking-wide uppercase">
|
||||||
HI
|
HI
|
||||||
</span>
|
</span>
|
||||||
@@ -382,7 +366,7 @@ function MapaCurricularPage() {
|
|||||||
id: nueva.id,
|
id: nueva.id,
|
||||||
nombre: nueva.nombre,
|
nombre: nueva.nombre,
|
||||||
orden: nueva.orden,
|
orden: nueva.orden,
|
||||||
color: '#1976d2',
|
color: (nueva as any).color ?? '#1976d2',
|
||||||
}
|
}
|
||||||
setLineas((prev) => [...prev, mapeada])
|
setLineas((prev) => [...prev, mapeada])
|
||||||
setNombreNuevaLinea('')
|
setNombreNuevaLinea('')
|
||||||
@@ -390,6 +374,24 @@ function MapaCurricularPage() {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cambiarColorLinea = (lineaId: string, nuevoColor: string) => {
|
||||||
|
setLineas((prev) =>
|
||||||
|
prev.map((l) => (l.id === lineaId ? { ...l, color: nuevoColor } : l)),
|
||||||
|
)
|
||||||
|
|
||||||
|
updateLineaApi(
|
||||||
|
{
|
||||||
|
lineaId,
|
||||||
|
patch: { color: nuevoColor },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
onError: (err) => {
|
||||||
|
console.error('Error al actualizar color de linea:', err)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
const guardarEdicionLinea = (id: string, nuevoNombre: string) => {
|
const guardarEdicionLinea = (id: string, nuevoNombre: string) => {
|
||||||
const nombreAFijar = nuevoNombre.trim()
|
const nombreAFijar = nuevoNombre.trim()
|
||||||
|
|
||||||
@@ -721,7 +723,7 @@ function MapaCurricularPage() {
|
|||||||
|
|
||||||
<div className="overflow-x-auto pb-6">
|
<div className="overflow-x-auto pb-6">
|
||||||
<div
|
<div
|
||||||
className="grid gap-3"
|
className="grid gap-3 pl-1"
|
||||||
style={{
|
style={{
|
||||||
gridTemplateColumns: `140px repeat(${ciclosTotales}, 188px) 120px`,
|
gridTemplateColumns: `140px repeat(${ciclosTotales}, 188px) 120px`,
|
||||||
}}
|
}}
|
||||||
@@ -749,7 +751,7 @@ function MapaCurricularPage() {
|
|||||||
return (
|
return (
|
||||||
<Fragment key={linea.id}>
|
<Fragment key={linea.id}>
|
||||||
<div
|
<div
|
||||||
className={`group relative flex items-start justify-between gap-2 rounded-xl border p-3 transition-all ${editingLineaId === linea.id ? 'ring-primary/30 ring-2' : 'cursor-text'}`}
|
className={`group relative flex flex-col gap-2 rounded-xl border p-3 transition-all ${editingLineaId === linea.id ? 'ring-primary/30 ring-2' : 'cursor-text'}`}
|
||||||
style={{
|
style={{
|
||||||
borderColor: hexToRgba(linea.color || '#1976d2', 0.24),
|
borderColor: hexToRgba(linea.color || '#1976d2', 0.24),
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
@@ -796,7 +798,40 @@ function MapaCurricularPage() {
|
|||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-1 flex shrink-0 items-center gap-1">
|
|
||||||
|
<div className="flex items-center justify-between gap-2">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div
|
||||||
|
className="border-border/70 bg-background relative inline-flex h-8 w-8 items-center justify-center rounded-md border"
|
||||||
|
style={{
|
||||||
|
borderColor: hexToRgba(
|
||||||
|
linea.color || '#1976d2',
|
||||||
|
0.35,
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="color"
|
||||||
|
aria-label="Cambiar color de línea"
|
||||||
|
value={linea.color || '#1976d2'}
|
||||||
|
onChange={(e) =>
|
||||||
|
cambiarColorLinea(linea.id, e.target.value)
|
||||||
|
}
|
||||||
|
className="absolute inset-0 h-full w-full cursor-pointer opacity-0"
|
||||||
|
/>
|
||||||
|
<Icons.Palette
|
||||||
|
className="text-muted-foreground h-4 w-4"
|
||||||
|
aria-hidden
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="border-border/70 h-5 w-5 rounded-full border"
|
||||||
|
style={{ backgroundColor: linea.color || '#1976d2' }}
|
||||||
|
aria-hidden
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
aria-label="Eliminar línea"
|
aria-label="Eliminar línea"
|
||||||
|
|||||||
+1
-6
@@ -31,12 +31,7 @@ export interface Carrera {
|
|||||||
facultadId: string
|
facultadId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LineaCurricular {
|
export type LineaCurricular = Tables<'lineas_plan'>
|
||||||
id: string
|
|
||||||
nombre: string
|
|
||||||
orden: number
|
|
||||||
color?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Asignatura {
|
export interface Asignatura {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -833,6 +833,7 @@ export type Database = {
|
|||||||
Row: {
|
Row: {
|
||||||
actualizado_en: string
|
actualizado_en: string
|
||||||
area: string | null
|
area: string | null
|
||||||
|
color: string | null
|
||||||
creado_en: string
|
creado_en: string
|
||||||
id: string
|
id: string
|
||||||
nombre: string
|
nombre: string
|
||||||
@@ -842,6 +843,7 @@ export type Database = {
|
|||||||
Insert: {
|
Insert: {
|
||||||
actualizado_en?: string
|
actualizado_en?: string
|
||||||
area?: string | null
|
area?: string | null
|
||||||
|
color?: string | null
|
||||||
creado_en?: string
|
creado_en?: string
|
||||||
id?: string
|
id?: string
|
||||||
nombre: string
|
nombre: string
|
||||||
@@ -851,6 +853,7 @@ export type Database = {
|
|||||||
Update: {
|
Update: {
|
||||||
actualizado_en?: string
|
actualizado_en?: string
|
||||||
area?: string | null
|
area?: string | null
|
||||||
|
color?: string | null
|
||||||
creado_en?: string
|
creado_en?: string
|
||||||
id?: string
|
id?: string
|
||||||
nombre?: string
|
nombre?: string
|
||||||
|
|||||||
Reference in New Issue
Block a user