Skip to content

Conversation

@santiagorodriguez96
Copy link
Collaborator

@santiagorodriguez96 santiagorodriguez96 commented Jul 14, 2025

Motivación

Cuando añadís o removes materias o las cambiás de semestre, no queda tan claro de que hay algo que está cargando por abajo y pareciera que se pudiera seguir usando la app, cuando de repente se actualizan los semestres porque se completó el request.

La idea es darles a los usuarios una forma clara de entender que la página está cargando.

Detalles

Este PR agrega funcionalidad para que al agregar, remover o mover una materia en el planificador, aparezca un 'foreground layer' para indicarles a los usuarios de que la página está cargando.

Quizás no es la mejor solución, pero es una solución simple que puede andar bien por ahora mientras pensamos en algo más sofisticado.

Copy link
Collaborator

@EmilioCristalli EmilioCristalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creo que visualmente no es ideal, pero igual es mejor que no mostrar nada (como tenemos ahora).

me parece que en el home hace tiempo hacíamos algo similar, de mostrar un div que cubriera todo, y después lo mejoramos a mostrar un spinner en las cosas que se deshabilitaban. Capaz se puede explorar algo similar acá

Comment on lines 8 to 10
foregroundLayer.addEventListener("click", function(event) {
event.preventDefault();
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

para qué es esto?
el div de por sí no atrapa ya los click y por lo tanto no les llega a los botones de abajo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me fijo! Puede ser que no sea necesario, no

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Listo ✅ -> 87f6df3


export default class extends Controller {
start() {
var foregroundLayer = document.createElement("div");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opiniones sobre poner este div derecho en el html con hidden y acá solo hacerlo visible (sacarle la clase)?

y después supongo que habrá que ponerle la clase de nuevo cuando termine el request, o remplazar el div entero con turbo_stream.replace

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lo pensé, si! Voy a probar a ver cómo queda

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Listo ✅ -> c25d6ee

) %>
<%= form.hidden_field :semester, value: semester %>
<%= form.button type: :submit, class: "cursor-pointer py-2 ps-3 material-icons text-gray-400 disabled:opacity-50 disabled:cursor-not-allowed", disabled: true, data: { subject_selector_target: "submitButton" } do %>
<%= form.button type: :submit, class: "cursor-pointer py-2 ps-3 material-icons text-gray-400 disabled:opacity-50 disabled:cursor-not-allowed", disabled: true, data: { subject_selector_target: "submitButton", action: "planner-loading#start" } do %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otra opción capaz puede ser poner data-action="turbo:submit-start->planner-loading#start" en el div#planner

creo que no serviría para el drag and drop, pero capaz se puede hacer algo para que lo incluya.
Y también incluiría otros request con turbo adentro del div, no sé si tenemos algún otro

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pruebo!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y también incluiría otros request con turbo adentro del div, no sé si tenemos algún otro

Ahora tenemos el de agregar semestre, por lo que habría que actualizar el turbo_stream para que oculte de nuevo el foreground layer.

Dado eso y que, como bien decís, con este aproach no se incluye el drag and drop, yo creo que prefiero la especificidad de cómo está ahora.

Qué te parece?

@santiagorodriguez96
Copy link
Collaborator Author

me parece que en el home hace tiempo hacíamos algo similar, de mostrar un div que cubriera todo, y después lo mejoramos a mostrar un spinner en las cosas que se deshabilitaban. Capaz se puede explorar algo similar acá

Exacto! De ahí es donde saqué la idea y mucha parte del código 😄

creo que visualmente no es ideal, pero igual es mejor que no mostrar nada (como tenemos ahora).

De acuerdo con esto 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants