Skip to content

Commit

Permalink
telefon-vergisi-hesaplayici: normalize texts and file names
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgurg committed Jul 16, 2023
1 parent 6862fed commit 8421871
Show file tree
Hide file tree
Showing 27 changed files with 61 additions and 54 deletions.
96 changes: 48 additions & 48 deletions calculators/telefon-vergisi-hesaplayici/data/presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,97 +5,97 @@ export default [
id: 1,
brandId: 1,
title: "iPhone 14 Pro",
slug: "iphone-14-pro",
slug: "iphone-14-pro", // TODO: "apple-" prefix will be added
releaseDate: new Date("2022-09-07"),
thumbnail: "telefon-vergisi-hesaplayici/img/iphone-14-pro.png",
url: buildUrl("iphone-14-pro"),
ogImageName: "telefon-vergisi-hesaplayici-iphone-14-pro.jpg",
pageTitle: "iPhone 14 Pro'nun vergisi ne kadar?",
pageDescription: "iPhone 14 Pro'nun vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
thumbnail: "telefon-vergisi-hesaplayici/img/apple-iphone-14-pro.png",
url: buildUrl("iphone-14-pro"), // TODO: "apple-" prefix will be added
ogImageName: "telefon-vergisi-hesaplayici-apple-iphone-14-pro.jpg",
pageTitle: "Apple iPhone 14 Pro'nun vergisi ne kadar?",
pageDescription: "Apple iPhone 14 Pro'nun vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
},
{
id: 2,
brandId: 1,
title: "iPhone 14 Pro Max",
slug: "iphone-14-pro-max",
slug: "iphone-14-pro-max", // TODO: "apple-" prefix will be added
releaseDate: new Date("2022-09-07"),
thumbnail: "telefon-vergisi-hesaplayici/img/iphone-14-pro-max.png",
url: buildUrl("iphone-14-pro-max"),
ogImageName: "telefon-vergisi-hesaplayici-iphone-14-pro-max.jpg",
pageTitle: "iPhone 14 Pro Max'in vergisi ne kadar?",
pageDescription: "iPhone 14 Pro Max'in vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
thumbnail: "telefon-vergisi-hesaplayici/img/apple-iphone-14-pro-max.png",
url: buildUrl("iphone-14-pro-max"), // TODO: "apple-" prefix will be added
ogImageName: "telefon-vergisi-hesaplayici-apple-iphone-14-pro-max.jpg",
pageTitle: "Apple iPhone 14 Pro Max'in vergisi ne kadar?",
pageDescription: "Apple iPhone 14 Pro Max'in vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
},
{
id: 3,
brandId: 1,
title: "iPhone 14",
slug: "iphone-14",
slug: "iphone-14", // TODO: "apple-" prefix will be added
releaseDate: new Date("2022-09-07"),
thumbnail: "telefon-vergisi-hesaplayici/img/iphone-14.png",
url: buildUrl("iphone-14"),
ogImageName: "telefon-vergisi-hesaplayici-iphone-14.jpg",
pageTitle: "iPhone 14'ün vergisi ne kadar?",
pageDescription: "iPhone 14'ün vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
thumbnail: "telefon-vergisi-hesaplayici/img/apple-iphone-14.png",
url: buildUrl("iphone-14"), // TODO: "apple-" prefix will be added
ogImageName: "telefon-vergisi-hesaplayici-apple-iphone-14.jpg",
pageTitle: "Apple iPhone 14'ün vergisi ne kadar?",
pageDescription: "Apple iPhone 14'ün vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
},
{
id: 4,
brandId: 1,
title: "iPhone 14 Plus",
slug: "iphone-14-plus",
slug: "iphone-14-plus", // TODO: "apple-" prefix will be added
releaseDate: new Date("2022-09-07"),
thumbnail: "telefon-vergisi-hesaplayici/img/iphone-14-plus.png",
url: buildUrl("iphone-14-plus"),
ogImageName: "telefon-vergisi-hesaplayici-iphone-14-plus.jpg",
pageTitle: "iPhone 14 Plus'ın vergisi ne kadar?",
pageDescription: "iPhone 14 Plus'ın vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
thumbnail: "telefon-vergisi-hesaplayici/img/apple-iphone-14-plus.png",
url: buildUrl("iphone-14-plus"), // TODO: "apple-" prefix will be added
ogImageName: "telefon-vergisi-hesaplayici-apple-iphone-14-plus.jpg",
pageTitle: "Apple iPhone 14 Plus'ın vergisi ne kadar?",
pageDescription: "Apple iPhone 14 Plus'ın vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
},
{
id: 5,
brandId: 1,
title: "iPhone 13 mini",
slug: "iphone-13-mini",
slug: "iphone-13-mini", // TODO: "apple-" prefix will be added
releaseDate: new Date("2021-09-24"),
thumbnail: "telefon-vergisi-hesaplayici/img/iphone-13-mini.png",
url: buildUrl("iphone-13-mini"),
ogImageName: "telefon-vergisi-hesaplayici-iphone-13-mini.jpg",
pageTitle: "iPhone 13 mini'nin vergisi ne kadar?",
pageDescription: "iPhone 13 mini'nin vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
thumbnail: "telefon-vergisi-hesaplayici/img/apple-iphone-13-mini.png",
url: buildUrl("iphone-13-mini"), // TODO: "apple-" prefix will be added
ogImageName: "telefon-vergisi-hesaplayici-apple-iphone-13-mini.jpg",
pageTitle: "Apple iPhone 13 mini'nin vergisi ne kadar?",
pageDescription: "Apple iPhone 13 mini'nin vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
},
{
id: 6,
brandId: 1,
title: "iPhone 13",
slug: "iphone-13",
slug: "iphone-13", // TODO: "apple-" prefix will be added
releaseDate: new Date("2021-09-24"),
thumbnail: "telefon-vergisi-hesaplayici/img/iphone-13.png",
url: buildUrl("iphone-13"),
ogImageName: "telefon-vergisi-hesaplayici-iphone-13.jpg",
pageTitle: "iPhone 13'ün vergisi ne kadar?",
pageDescription: "iPhone 13'ün vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
thumbnail: "telefon-vergisi-hesaplayici/img/apple-iphone-13.png",
url: buildUrl("iphone-13"), // TODO: "apple-" prefix will be added
ogImageName: "telefon-vergisi-hesaplayici-apple-iphone-13.jpg",
pageTitle: "Apple iPhone 13'ün vergisi ne kadar?",
pageDescription: "Apple iPhone 13'ün vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
},
{
id: 7,
brandId: 1,
title: "iPhone SE 3",
slug: "iphone-se-3-2022",
slug: "iphone-se-3-2022", // TODO: "apple-" prefix will be added
releaseDate: new Date("2022-03-08"),
thumbnail: "telefon-vergisi-hesaplayici/img/iphone-se-3-2022.png",
url: buildUrl("iphone-se-3-2022"),
ogImageName: "telefon-vergisi-hesaplayici-iphone-se-2022.jpg",
pageTitle: "iPhone SE 3'ün (2022) vergisi ne kadar?",
pageDescription: "iPhone SE 3 (2022)'ün vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
thumbnail: "telefon-vergisi-hesaplayici/img/apple-iphone-se-3-2022.png",
url: buildUrl("iphone-se-3-2022"), // TODO: "apple-" prefix will be added
ogImageName: "telefon-vergisi-hesaplayici-apple-iphone-se-2022.jpg",
pageTitle: "Apple iPhone SE 3'ün (2022) vergisi ne kadar?",
pageDescription: "Apple iPhone SE 3 (2022)'ün vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
},
{
id: 8,
brandId: 1,
title: "iPhone 12",
slug: "iphone-12",
slug: "iphone-12", // TODO: "apple-" prefix will be added
releaseDate: new Date("2020-10-13"),
thumbnail: "telefon-vergisi-hesaplayici/img/iphone-12.png",
url: buildUrl("iphone-12"),
ogImageName: "telefon-vergisi-hesaplayici-iphone-12.jpg",
pageTitle: "iPhone 12'nin vergisi ne kadar?",
pageDescription: "iPhone 12'nin vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
thumbnail: "telefon-vergisi-hesaplayici/img/apple-iphone-12.png",
url: buildUrl("iphone-12"), // TODO: "apple-" prefix will be added
ogImageName: "telefon-vergisi-hesaplayici-apple-iphone-12.jpg",
pageTitle: "Apple iPhone 12'nin vergisi ne kadar?",
pageDescription: "Apple iPhone 12'nin vergili ve vergisiz fiyatını hesaplayın, yurt içi ve yurt dışı fiyatlarını karşılaştırın."
},
{
id: 9,
Expand Down
13 changes: 9 additions & 4 deletions calculators/telefon-vergisi-hesaplayici/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,30 @@ import brands from "@/calculators/telefon-vergisi-hesaplayici/data/brands.js";
import presets from "@/calculators/telefon-vergisi-hesaplayici/data/presets.js";
import presetOptions from "@/calculators/telefon-vergisi-hesaplayici/data/preset-options.js";

const findPresetsByBrandId = (brandId, presets) => {
const findBrandById = brandId => {
return brands.find(brand => brand.id === brandId);
};

const findPresetsByBrandId = brandId => {
return presets.filter(preset => preset.brandId === brandId);
};

const findPresetOptionsByPresetId = (presetId, presetOptions) => {
const findPresetOptionsByPresetId = presetId => {
return presetOptions.filter(presetOption => presetOption.presetId === presetId);
};

const buildCalculations = () => {
return brands.map(brand => ({
brand,
presets: findPresetsByBrandId(brand.id, presets).map(preset => ({
presets: findPresetsByBrandId(brand.id).map(preset => ({
...preset,
options: findPresetOptionsByPresetId(preset.id, presetOptions)
options: findPresetOptionsByPresetId(preset.id)
}))
}));
};

export {
findBrandById,
findPresetsByBrandId,
findPresetOptionsByPresetId,
buildCalculations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import TelefonVergisiHesaplayici from "@/data/pages/telefon-vergisi-hesaplayici/
import { findCalculatorPresetBySlug } from "@/utils/find-calculator-preset-by-slug.js";

import presets from "@/calculators/telefon-vergisi-hesaplayici/data/presets.js";
import { findPresetOptionsByPresetId } from "@/calculators/telefon-vergisi-hesaplayici/utils.js";
import { findPresetOptionsByPresetId, findBrandById } from "@/calculators/telefon-vergisi-hesaplayici/utils.js";
import presetOptions from "@/calculators/telefon-vergisi-hesaplayici/data/preset-options.js";

export default slug => {
Expand All @@ -12,6 +12,8 @@ export default slug => {
return false;
}

const brand = findBrandById(preset.brandId);

const title = preset.pageTitle;
const url = preset.url;
const description = preset.pageDescription;
Expand All @@ -22,7 +24,7 @@ export default slug => {
});
const breadcrumbs = [
...TelefonVergisiHesaplayici.breadcrumbs,
{ title: preset.title, url }
{ title: `${brand.title} ${preset.title}`, url }
];

const options = findPresetOptionsByPresetId(preset.id, presetOptions);
Expand Down

0 comments on commit 8421871

Please sign in to comment.