Limpiar codigo

master
Fernando 2021-08-18 17:09:02 -05:00
parent 07668ed201
commit fe98b12130
3 changed files with 210 additions and 216 deletions

View File

@ -34,6 +34,13 @@ const e = StyleSheet.create({
},
})
const claseCursoNoAgregado = css(
e.contenedorCurso,
estilosGlobales.contenedor,
)
const claseCursoOculto = css(e.cursoOculto)
interface Props {
version: number,
dataAnio: Cursos,
@ -101,27 +108,13 @@ const agruparProfesores = (
return profesores
}
export function CursosElem(props: Props) {
const anio = () => props.anioActual().substring(0, props.anioActual().indexOf(" "))
const claseCursoNoAgregado = css(
e.contenedorCurso,
estilosGlobales.contenedor,
)
const claseCursoAgregado = css(
e.contenedorCurso,
estilosGlobales.contenedor,
!props.esCursoMiHorario && estilosGlobales.contenedorCursorActivo,
)
const claseCursoOculto = css(e.cursoOculto)
return (
<>
<For each={Object.entries(props.dataAnio)}>
{([indiceCurso, datosCurso]) => {
function CursoE(
indiceCurso: string,
datosCurso: Curso,
anio: () => string,
claseCursoAgregado: string,
props: Props
) {
const idCurso = `${props.version}_${anio()}_${datosCurso.abreviado}`
const cursoAgregadoMemo = createMemo(
@ -156,6 +149,26 @@ export function CursosElem(props: Props) {
props.setCursosUsuarios,
))
const IndicadorGrupos = (profesor: string, grupos: [string, () => void][], esLab: boolean) => (
<td style={{"padding-bottom": "0.5rem", "padding-right": "0.75rem"}}>
<span>
{profesor}&nbsp;
</span>
<For each={grupos}>
{([x, fnOnClick]) => (
<IndicadorGrupo
nombre={x}
esLab={esLab}
idParcial={idCurso}
tablaObserver={props.tablaObserver}
onClick={fnOnClick}
/>
)
}
</For>
</td>
)
return (
<div className={claseMemo()}>
<button
@ -169,48 +182,12 @@ export function CursosElem(props: Props) {
<tbody>
<tr>
<For each={Object.entries(profesoresTeoria())}>
{([profesor, grupos]) => (
<td style={{"padding-bottom": "0.5rem", "padding-right": "0.75rem"}}>
<span>
{profesor}&nbsp;
</span>
<For each={grupos}>
{([x, fnOnClick]) => (
<IndicadorGrupo
nombre={x}
esLab={false}
idParcial={idCurso}
tablaObserver={props.tablaObserver}
onClick={fnOnClick}
/>
)
}
</For>
</td>
)}
{([profesor, grupos]) => IndicadorGrupos(profesor, grupos, false)}
</For>
</tr>
<tr>
<For each={Object.entries(profesoresLab())}>
{([profesor, grupos]) => (
<td style={{"padding-bottom": "0.5rem", "padding-right": "0.75rem"}}>
<span>
{profesor}&nbsp;
</span>
<For each={grupos}>
{([x, fnOnClick]) => (
<IndicadorGrupo
nombre={x}
esLab
idParcial={idCurso}
tablaObserver={props.tablaObserver}
onClick={fnOnClick}
/>
)
}
</For>
</td>
)}
{([profesor, grupos]) => IndicadorGrupos(profesor, grupos, true)}
</For>
</tr>
</tbody>
@ -223,7 +200,21 @@ export function CursosElem(props: Props) {
</button>
</div>
)
}}
}
export function CursosElem(props: Props) {
const anio = () => props.anioActual().substring(0, props.anioActual().indexOf(" "))
const claseCursoAgregado = css(
e.contenedorCurso,
estilosGlobales.contenedor,
!props.esCursoMiHorario && estilosGlobales.contenedorCursorActivo,
)
return (
<>
<For each={Object.entries(props.dataAnio)}>
{([indiceCurso, datosCurso]) => CursoE(indiceCurso, datosCurso, anio, claseCursoAgregado, props)}
</For>
</>
)

View File

@ -72,6 +72,14 @@ const clasesColores = {
Viernes: css(eColores.viernes),
}
interface DatosProps {
id: string,
txt: string,
esLab: boolean,
datosGrupo: DatosGrupo,
fnSeleccionar: () => void
}
interface Props {
/**
* Informacion de los cursos a renderizar en la celda
@ -82,13 +90,7 @@ interface Props {
*
* esLab - Boolean que indica si el grupo es de laboratorio
*/
datos: {
id: string,
txt: string,
esLab: boolean,
datosGrupo: DatosGrupo,
fnSeleccionar: () => void
}[],
datos: DatosProps[],
fnResaltarFila: () => void,
fnDesresaltarFila: () => void,
dia: Dia,
@ -97,13 +99,7 @@ interface Props {
const claseSeldaSeleccionada = css(e.celdaSeleccionado)
export function CeldaFila(props: Props) {
const datos = props.datos
return (
<div className={css(e.celdaComun, estilosGlobales.inlineBlock)}>
<For each={datos}>
{(datos) => {
function RenderFila(datos: DatosProps, props: Props) {
const id = datos.id
const txt = datos.txt
const esLab = datos.esLab
@ -199,7 +195,15 @@ export function CeldaFila(props: Props) {
{txt}
</button>
)
}}
}
export function CeldaFila(props: Props) {
const datos = props.datos
return (
<div className={css(e.celdaComun, estilosGlobales.inlineBlock)}>
<For each={datos}>
{(datos) => RenderFila(datos, props)}
</For>
</div>
)

View File

@ -132,7 +132,6 @@ export function FilaTabla(props: Props) {
</div>
<For each={dias}>
{(dia) => {
console.log("Renderizar dias")
const diaStr = dia.substring(0, 2)
const horaStr = hora.substring(0, 5)