Skip to content

Commit

Permalink
telefon-vergisi-hesaplayici: group presets by their brand
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgurg committed Jul 4, 2023
1 parent 9c0dc11 commit dc6d806
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
4 changes: 4 additions & 0 deletions assets/scss/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
gap: 8px !important
}

.gap-16 {
gap: 32px !important
}

.tabular-nums {
font-variant-numeric: tabular-nums
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const lastUpdatedDateSamsung = new Date("Sat Jul 01 2023 08:22:32 GMT+0300 (GMT+
const presets = [
// Apple Vision Pro
{
brand: "Apple",
title: "Apple Vision Pro",
slug: "apple-vision-pro",
url: buildUrl("apple-vision-pro"),
Expand All @@ -29,6 +30,7 @@ const presets = [

// iPhone 14
{
brand: "Apple",
title: "iPhone 14 Pro",
slug: "iphone-14-pro",
url: buildUrl("iphone-14-pro"),
Expand Down Expand Up @@ -77,6 +79,7 @@ const presets = [
]
},
{
brand: "Apple",
title: "iPhone 14 Pro Max",
slug: "iphone-14-pro-max",
url: buildUrl("iphone-14-pro-max"),
Expand Down Expand Up @@ -125,6 +128,7 @@ const presets = [
]
},
{
brand: "Apple",
title: "iPhone 14",
slug: "iphone-14",
url: buildUrl("iphone-14"),
Expand Down Expand Up @@ -164,6 +168,7 @@ const presets = [
]
},
{
brand: "Apple",
title: "iPhone 14 Plus",
slug: "iphone-14-plus",
url: buildUrl("iphone-14-plus"),
Expand Down Expand Up @@ -206,6 +211,7 @@ const presets = [

// iPhone 13
{
brand: "Apple",
title: "iPhone 13 mini",
slug: "iphone-13-mini",
url: buildUrl("iphone-13-mini"),
Expand Down Expand Up @@ -245,6 +251,7 @@ const presets = [
]
},
{
brand: "Apple",
title: "iPhone 13",
slug: "iphone-13",
url: buildUrl("iphone-13"),
Expand Down Expand Up @@ -287,6 +294,7 @@ const presets = [

// iPhone SE
{
brand: "Apple",
title: "iPhone SE 3 (2022)",
slug: "iphone-se-3-2022",
url: buildUrl("iphone-se-3-2022"),
Expand Down Expand Up @@ -329,6 +337,7 @@ const presets = [

// iPhone 12
{
brand: "Apple",
title: "iPhone 12",
slug: "iphone-12",
url: buildUrl("iphone-12"),
Expand Down Expand Up @@ -371,6 +380,7 @@ const presets = [

// Samsung Galaxy S23
{
brand: "Samsung",
title: "Samsung Galaxy S23",
slug: "samsung-galaxy-s23",
url: buildUrl("samsung-galaxy-s23"),
Expand Down Expand Up @@ -401,6 +411,7 @@ const presets = [
]
},
{
brand: "Samsung",
title: "Samsung Galaxy S23+",
slug: "samsung-galaxy-s23-plus",
url: buildUrl("samsung-galaxy-s23-plus"),
Expand All @@ -426,6 +437,7 @@ const presets = [
]
},
{
brand: "Samsung",
title: "Samsung Galaxy S23 Ultra",
slug: "samsung-galaxy-s23-ultra",
url: buildUrl("samsung-galaxy-s23-ultra"),
Expand Down
37 changes: 31 additions & 6 deletions pages/telefon-vergisi-hesaplayici/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@

<InnerContainer>
<FormRow>
<PageSubtitle class="mb-4">
Bir telefon seçin…
</PageSubtitle>

<CalculatorPresets :presets="ui.presets" />
<div class="d-flex flex-column gap-16">
<template v-for="_item in presetsGroupedByBrand">
<div :key="_item.title">
<PageSubtitle class="mb-2">
{{ _item.title }}
</PageSubtitle>
<CalculatorPresets :presets="_item.presets" />
</div>
</template>
</div>

<v-divider class="my-12" />

<PageSubtitle class="mb-4">
…veya kendiniz hesaplayın
Kendiniz hesaplayın
</PageSubtitle>
</FormRow>

Expand Down Expand Up @@ -177,6 +182,26 @@ export default {
currency: vm.form.currency,
registrationTitle: vm.ui.registration.find(item => item.value === vm.form.registration).title
});
},
presetsGroupedByBrand() {
const vm = this;
const output = {};
vm.ui.presets.forEach(preset => {
const { brand, ...rest } = preset;
if (!output[brand]) {
output[brand] = {
title: brand,
presets: []
};
}
output[brand].presets.push({
brand, ...rest
});
});
return Object.values(output);
}
},
watch: {
Expand Down

0 comments on commit dc6d806

Please sign in to comment.