Skip to content

Commit

Permalink
links to los estudiantes
Browse files Browse the repository at this point in the history
  • Loading branch information
vis97c committed Nov 11, 2024
1 parent eaa413f commit de32d0b
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 21 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion app.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="x-layout">
<NuxtLoadingIndicator class="x-layout-loader" :duration="5000" color="#2980b9" />
<NuxtLoadingIndicator class="x-layout-loader" :duration="5000" color="#0f47af" />
<div class="flx --flxColumn --flx-start-stretch --gap-0">
<div
v-if="SESSION.user && APP.instance?.banner?.message"
Expand Down
6 changes: 5 additions & 1 deletion assets/scss/overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

// override xamu style system parameters

$estudiantes: #337ab7;

@use "@open-xamu-co/ui-styles/src/utils/module" with (
// allowances
$allow-responsive-upscaling: false,
// sizes
$size-px: (1080, 980, 480, 440, 330, 220, 180, 90)
$size-px: (1080, 980, 480, 440, 330, 220, 180, 90),
// colors
$extra-colors: (estudiantes: $estudiantes)
);

@forward "@open-xamu-co/ui-styles/src/utils/module";
43 changes: 43 additions & 0 deletions components/teachersList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<template>
<div class="flx --flxRow --flx-start-center --gap-5">
<div v-if="props.value.length" class="flx --flxRow --flx-start-center --gap-5">
<div class="--txtWrap-nowrap">
<b class="--txtColor-estudiantes">{{ props.value.length }}</b>
</div>
<template v-for="(childValue, childValueIndex) in props.value" :key="childValueIndex">
<XamuActionLink
:theme="'estudiantes' as any"
tooltip="Ver en los estudiantes"
:href="`${losEstudiantesProfessors}/${kebabCase(childValue)}`"
>
<XamuIconFa name="hand-fist" />
<XamuValue v-bind="{ value: childValue, modalProps: props.modalProps }" />
</XamuActionLink>
<span v-if="childValueIndex < props.value.length - 1">⋅</span>
</template>
</div>
<span v-else>-</span>
</div>
</template>
<script setup lang="ts">
import { kebabCase } from "lodash-es";
/**
* Teachers list
*
* @component
*/
defineOptions({ name: "ValueComplex", inheritAttrs: false });
const props = defineProps<{
value: string[];
modalProps?: Record<string, any>;
}>();
const APP = useAppStore();
const { losEstudiantesUrl = "", losEstudiantesProfessorsPath = "" } =
APP.instance?.config || {};
const losEstudiantesProfessors = `${losEstudiantesUrl}${losEstudiantesProfessorsPath}`;
</script>
12 changes: 12 additions & 0 deletions functions/src/types/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ export interface InstanceData extends FirebaseData {
* @example ?taskflowId=task-flow-AC_CatalogoAsignaturas
*/
siaOldQuery?: string;
/**
* @example https://losestudiantes.com
*/
losEstudiantesUrl?: string;
/**
* @example /universidad-nacional/courses
*/
losEstudiantesCoursesPath?: string;
/**
* @example /universidad-nacional/professors
*/
losEstudiantesProfessorsPath?: string;
};
/**
* Feature flags
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@nuxt/scripts": "^0.9.5",
"@open-xamu-co/ui-common-enums": "^3.0.0-next.6",
"@open-xamu-co/ui-common-helpers": "^3.0.0-next.14",
"@open-xamu-co/ui-components-vue": "^3.0.0-next.44",
"@open-xamu-co/ui-components-vue": "^3.0.0-next.45",
"@open-xamu-co/ui-nuxt": "^3.0.0-next.9",
"@pinia-plugin-persistedstate/nuxt": "^1.1.0",
"@pinia/nuxt": "^0.5.1",
Expand All @@ -46,7 +46,7 @@
"@firebase/app-types": "^0.9.0",
"@nuxt/devtools": "^1.0.8",
"@open-xamu-co/eslint-config": "^3.0.1",
"@open-xamu-co/ui-common-types": "^3.0.0-next.19",
"@open-xamu-co/ui-common-types": "^3.0.0-next.20",
"@open-xamu-co/ui-styles": "^3.0.0-next.24",
"@types/lodash": "^4.14.191",
"@types/lodash-es": "^4",
Expand Down
42 changes: 35 additions & 7 deletions pages/cursos/[courseId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,38 @@
</p>
<div class="flx --flxRow-wrap --flx-start-center">
<XamuActionButton
:theme="'estudiantes' as any"
tooltip="Ver en los estudiantes"
:href="`${losEstudiantesCourses}/${course.code}`"
:size="eSizes.LG"
round
>
<XamuIconFa name="hand-fist" :size="20" />
</XamuActionButton>
<XamuActionButtonToggle
tooltip="Notificarme"
:disabled="!APP.instance?.flags?.trackCourses"
:size="eSizes.LG"
round
@click="trackCourse"
>
Notificarme
</XamuActionButton>
<XamuIconFa name="bell" :size="20" regular />
<XamuIconFa name="bell" :size="20" />
</XamuActionButtonToggle>
<template v-if="SESSION.canModerate">
<XamuModal
class="--txtColor"
title="Nuevo grupo"
title="Añadir grupo no reportado"
:save-button="{ title: 'Añadir grupo' }"
invert-theme
@close="closeAddGroup"
@save="addGroup"
>
<template #toggle="{ toggleModal }">
<XamuActionButton @click="toggleModal">
<XamuActionButton
tooltip="¿Hay un grupo no reportado?"
@click="toggleModal"
>
Añadir grupo
</XamuActionButton>
</template>
Expand All @@ -45,6 +61,7 @@
<XamuForm
v-model="addGroupInputs"
v-model:invalid="invalidAddGroup"
title="Nuevo grupo"
/>
</div>
</template>
Expand Down Expand Up @@ -85,6 +102,7 @@
<XamuTable
:nodes="mapGroups"
:modal-props="{ class: '--txtColor', invertTheme: true }"
:properties="[{ value: 'profesores', component: TeachersList }]"
/>
</div>
<div v-if="mapUnreported.length" class="flx --flxColumn --flx-start --width-100">
Expand All @@ -99,6 +117,7 @@
:nodes="mapUnreported"
:theme="eColors.PRIMARY"
:modal-props="{ class: '--txtColor', invertTheme: true }"
:properties="[{ value: 'profesores', component: TeachersList }]"
/>
</div>
</template>
Expand All @@ -111,11 +130,12 @@
import { arrayUnion, doc, onSnapshot } from "firebase/firestore";
import { FirebaseError } from "firebase/app";
import type { iInvalidInput, iPageEdge } from "@open-xamu-co/ui-common-types";
import { eColors } from "@open-xamu-co/ui-common-enums";
import { eColors, eSizes } from "@open-xamu-co/ui-common-enums";
import type { Course, Group, Teacher } from "~/resources/types/entities";
import { resolveSnapshotDefaults } from "~/resources/utils/firestore";
import { eSIALevel, eSIAPlace } from "~/functions/src/types/SIA";
import { TeachersList } from "#components";
/**
* Course page
Expand All @@ -136,6 +156,8 @@
const { $clientFirestore } = useNuxtApp();
const { getResponse } = useFormInput();
const { losEstudiantesUrl = "", losEstudiantesCoursesPath = "" } = APP.instance?.config || {};
const losEstudiantesCourses = `${losEstudiantesUrl}${losEstudiantesCoursesPath}`;
const loading = ref(true);
const refetching = ref(false);
const deactivated = ref(false);
Expand Down Expand Up @@ -177,7 +199,7 @@
cupos: `${availableSpots} de ${spots}`,
actividad: activity,
espacios: classrooms,
profesores: teachers?.map((teacher) => `${teacher}ㅤ`), // hotfix to prevent it to parse as date
profesores: teachers,
horarios: { lunes, martes, miercoles, jueves, viernes, sabado, domingo },
};
}
Expand Down Expand Up @@ -364,7 +386,13 @@
}
// Reindex
await useIndexCourse({ ...SIACourse, updatedAt, indexed: true, indexedTeachers });
await useIndexCourse({
...course.value,
...SIACourse,
updatedAt,
indexed: true,
indexedTeachers,
});
refetching.value = false;
});
Expand Down
1 change: 1 addition & 0 deletions resources/utils/firestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export function resolveSnapshotDefaults<T extends PseudoNode>(
id,
updatedAt: node?.updatedAt?.toDate(),
createdAt: node?.createdAt?.toDate(),
scrapedAt: node?.scrapedAt?.toDate(),
});
}
export function getDocumentId(path?: string): string {
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2840,20 +2840,20 @@ __metadata:
languageName: node
linkType: hard

"@open-xamu-co/ui-common-types@npm:^3.0.0-next.19":
version: 3.0.0-next.19
resolution: "@open-xamu-co/ui-common-types@npm:3.0.0-next.19"
"@open-xamu-co/ui-common-types@npm:^3.0.0-next.20":
version: 3.0.0-next.20
resolution: "@open-xamu-co/ui-common-types@npm:3.0.0-next.20"
dependencies:
"@fortawesome/fontawesome-common-types": "npm:^6.4.0"
"@open-xamu-co/ui-common-enums": "npm:^3.0.0-next.6"
sweetalert2: "npm:^11.11.1"
checksum: 10c0/aaab71f8e04e2df81afac21c067b2f3bf9bddc91b1aebc0288295825c777b8dbda5f231fbe80751c7b65531ba5645884520b33f254b5c5f48ced474ee0ac92c0
checksum: 10c0/856f1f846c3ba9b3968f27648a1091a64c488e6a6706049fe25e7b6346a40168c4c2250986bd52f371b6ff6452d5cc9abf47bf8ad503718676bb59050cd10e59
languageName: node
linkType: hard

"@open-xamu-co/ui-components-vue@npm:^3.0.0-next.43, @open-xamu-co/ui-components-vue@npm:^3.0.0-next.44":
version: 3.0.0-next.44
resolution: "@open-xamu-co/ui-components-vue@npm:3.0.0-next.44"
"@open-xamu-co/ui-components-vue@npm:^3.0.0-next.43, @open-xamu-co/ui-components-vue@npm:^3.0.0-next.45":
version: 3.0.0-next.45
resolution: "@open-xamu-co/ui-components-vue@npm:3.0.0-next.45"
dependencies:
"@fortawesome/fontawesome-common-types": "npm:^6.4.0"
"@open-xamu-co/ui-common-enums": "npm:^3.0.0-next.6"
Expand All @@ -2866,7 +2866,7 @@ __metadata:
peerDependenciesMeta:
vue-router:
optional: true
checksum: 10c0/12d846ddb344f56b62bb4915d7869140ec568021222ab680a86154625da01d328d2105fccc7b3b68798da7c54dba9ab6a7d20adc60eb4f5397cbb05b2f189ea5
checksum: 10c0/e003f270aa426d224adee4c2673f338247e24b0f8f948557cd34521b0ac1aee7326a346b03ae705eebeb58e29fd381d33fd6fb886709d0023ca53ae180c3eb27
languageName: node
linkType: hard

Expand Down Expand Up @@ -16012,8 +16012,8 @@ postcss-precision@vis97c/postcss-precision:
"@open-xamu-co/eslint-config": "npm:^3.0.1"
"@open-xamu-co/ui-common-enums": "npm:^3.0.0-next.6"
"@open-xamu-co/ui-common-helpers": "npm:^3.0.0-next.14"
"@open-xamu-co/ui-common-types": "npm:^3.0.0-next.19"
"@open-xamu-co/ui-components-vue": "npm:^3.0.0-next.44"
"@open-xamu-co/ui-common-types": "npm:^3.0.0-next.20"
"@open-xamu-co/ui-components-vue": "npm:^3.0.0-next.45"
"@open-xamu-co/ui-nuxt": "npm:^3.0.0-next.9"
"@open-xamu-co/ui-styles": "npm:^3.0.0-next.24"
"@pinia-plugin-persistedstate/nuxt": "npm:^1.1.0"
Expand Down

0 comments on commit de32d0b

Please sign in to comment.