diff --git a/public/fonts/inter-v20-latin_latin-ext-800.woff2 b/public/fonts/inter-v20-latin_latin-ext-800.woff2 new file mode 100644 index 0000000..f89345a Binary files /dev/null and b/public/fonts/inter-v20-latin_latin-ext-800.woff2 differ diff --git a/src/components/VehiclesManager/VehicleEditModal.vue b/src/components/VehiclesManager/VehicleEditModal.vue index 0d1d2b5..2903d70 100644 --- a/src/components/VehiclesManager/VehicleEditModal.vue +++ b/src/components/VehiclesManager/VehicleEditModal.vue @@ -89,7 +89,7 @@ @@ -135,20 +135,26 @@ onMounted(() => { vehiclesStore.vehiclesTable.find((v) => v.vehicleRef.id == vehiclesStore.selectedVehicleId)?.vehicleRef ?? null; if (currentVehicleRef.value) { - vehicleValues.name = currentVehicleRef.value.name || ''; - vehicleValues.cabinName = currentVehicleRef.value.cabinName || ''; - vehicleValues.type = currentVehicleRef.value.type || ''; - vehicleValues.vehicleGroupsId = currentVehicleRef.value.vehicleGroupsId || 0; - vehicleValues.hidden = currentVehicleRef.value.hidden; - vehicleValues.restrictions = { - sponsorOnly: currentVehicleRef.value.restrictions?.sponsorOnly ?? null, - teamOnly: currentVehicleRef.value.restrictions?.teamOnly ?? false, - }; + populateVehicleValues(currentVehicleRef.value); } modalElementRef.value?.focus(); }); +function populateVehicleValues(vehicle: IVehicle) { + const lastProps = vehiclesStore.lastVehicleUpdateProps; + + vehicleValues.name = vehicle.name || ''; + vehicleValues.cabinName = lastProps.cabinName || vehicle.cabinName; + vehicleValues.type = lastProps.type || vehicle.type || ''; + vehicleValues.vehicleGroupsId = lastProps.vehicleGroupsId || vehicle.vehicleGroupsId || 0; + vehicleValues.hidden = lastProps.hidden || vehicle.hidden; + vehicleValues.restrictions = { + sponsorOnly: lastProps.restrictions?.sponsorOnly ?? vehicle.restrictions?.sponsorOnly ?? null, + teamOnly: lastProps.restrictions?.teamOnly ?? vehicle.restrictions?.teamOnly ?? false, + }; +} + function closeModal() { vehiclesStore.selectedVehicleId = -1; } @@ -197,6 +203,8 @@ async function updateVehicle() { oldGroup._count.vehicles -= 1; newGroup._count.vehicles += 1; + vehiclesStore.lastVehicleUpdateProps = updatedData; + alert('Zaktualizowano pojazd: ' + updatedData.name); } catch (error) { alert(handleAPIErrors(error)); diff --git a/src/components/VehiclesManager/VehicleGroupEditModal.vue b/src/components/VehiclesManager/VehicleGroupEditModal.vue index 39fbefb..2fb2cc8 100644 --- a/src/components/VehiclesManager/VehicleGroupEditModal.vue +++ b/src/components/VehiclesManager/VehicleGroupEditModal.vue @@ -71,8 +71,11 @@
+ (JSON: {{ isCargoTypesJsonValid ? 'poprawny' : 'niepoprawny' }})
- +
@@ -80,7 +83,7 @@ (JSON: {{ isMassSpeedsJsonValid ? 'poprawny' : 'niepoprawny' }})
-
@@ -91,14 +94,14 @@ - + diff --git a/src/components/VehiclesManager/VehiclesTable.vue b/src/components/VehiclesManager/VehiclesTable.vue index a2e6b4a..40ae62d 100644 --- a/src/components/VehiclesManager/VehiclesTable.vue +++ b/src/components/VehiclesManager/VehiclesTable.vue @@ -183,3 +183,7 @@ async function addVehicleRow() { } } + + diff --git a/src/stores/vehicles.store.ts b/src/stores/vehicles.store.ts index 9bfcfce..b50bedc 100644 --- a/src/stores/vehicles.store.ts +++ b/src/stores/vehicles.store.ts @@ -15,6 +15,7 @@ import { ICreateVehicleGroupBody, RemoveVehicleGroupAPIResponse, IVehicleGroupAPI, + IVehicleGroup, } from '../types/vehicles.types'; import { LoadingState } from '../types/common.types'; @@ -26,6 +27,9 @@ export const useVehiclesStore = defineStore('vehiclesStore', { selectedVehicleId: -1, selectedVehicleGroupId: -1, + lastVehicleUpdateProps: {} as Partial, + lastVehicleGroupUpdateProps: {} as Partial, + vehiclesTable: [] as IVehicleTableRow[], vehicleGroupsTable: [] as IVehicleGroupTableRow[], }), diff --git a/src/styles/_fonts.scss b/src/styles/_fonts.scss index 3b041f3..862c819 100644 --- a/src/styles/_fonts.scss +++ b/src/styles/_fonts.scss @@ -21,3 +21,11 @@ font-weight: 600; src: url('/fonts/inter-v19-latin_latin-ext-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ } + +@font-face { + font-display: swap; + font-family: 'Inter'; + font-style: normal; + font-weight: 800; + src: url('/fonts/inter-v20-latin_latin-ext-800.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} diff --git a/src/styles/_global.scss b/src/styles/_global.scss index fcb6c07..b7db71b 100644 --- a/src/styles/_global.scss +++ b/src/styles/_global.scss @@ -1,4 +1,4 @@ -@use "sass:color"; +@use 'sass:color'; @use 'fonts'; body, @@ -61,7 +61,6 @@ table thead tr td img { table tbody tr { background-color: #2c394b; - transition: background-color 100ms; text-overflow: ellipsis; } @@ -86,7 +85,7 @@ table tbody tr td img { vertical-align: middle; } -// Other +// Other button, select, input { diff --git a/src/styles/_vehicle_tables.scss b/src/styles/_vehicle_tables.scss new file mode 100644 index 0000000..920c8bf --- /dev/null +++ b/src/styles/_vehicle_tables.scss @@ -0,0 +1,40 @@ +.table-search-box { + display: flex; + gap: 0.5em; + margin-top: 0.5em; +} + +.table-wrapper { + width: 100%; + overflow: auto; + margin-top: 1em; +} + +.table-wrapper table > thead > tr > td { + & > div { + display: flex; + justify-content: center; + align-items: center; + gap: 0.5em; + } + + &[data-sortable='true'] { + cursor: pointer; + } +} + +.table-wrapper table > tbody > tr { + cursor: pointer; + + &:hover { + background: #1a293b; + } +} + +.table-visible-results-box { + margin-top: 0.5em; +} + +.table-visible-results-box input { + max-width: 70px; +} diff --git a/src/views/VehiclesManagerView.vue b/src/views/VehiclesManagerView.vue index 0974b74..f20becc 100644 --- a/src/views/VehiclesManagerView.vue +++ b/src/views/VehiclesManagerView.vue @@ -9,8 +9,8 @@
- - + +
@@ -46,7 +46,7 @@ function changeTab(tabName: TableTabName) { } -