Skip to content
Snippets Groups Projects
Commit d2ca284e authored by Mark Kane's avatar Mark Kane
Browse files

Conf: add .editorconfig (planning#401)

parent e8845009
No related branches found
No related tags found
1 merge request!24Fix: get status from tags (planning#401)
# http://editorconfig.org
root = true
[*.{json, yaml, yml, md, mdx, js, jsx}]
end_of_line = lf
indent_size = 2
indent_style = space
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
......@@ -4,24 +4,24 @@ import { fetchServices, fetchService, Filter, ServiceType, Tag } from '@/lib/con
import { removeFromObjRecursive, replaceEmailsRecursive } from '@/lib/utils'
import { documentToHtmlString } from '@contentful/rich-text-html-renderer'
import { IconChevronLeft } from '@tabler/icons'
import filterData from '@/lib/assets/data/currentFilter.json';
import filterData from '@/lib/assets/data/currentFilter.json'
function getServiceTag(service: ServiceType): Tag {
const ONLY_STATUS_TAG = 0;
const statusTag = service.tags?.filter((tag: Tag) => tag.fields?.name.startsWith('status'))[ONLY_STATUS_TAG];
const ONLY_STATUS_TAG = 0
const statusTag = service.tags?.filter((tag: Tag) => tag.fields?.name.startsWith('status'))[ONLY_STATUS_TAG]
return statusTag;
return statusTag
}
function getTagLabelValue(tag: Tag): string {
const ONLY_MATCHING_FILTER = 0;
const TAG_LABEL_EXPRESSION = 1;
const STATUS_FILTER_DEFINITION = 1;
const ONLY_MATCHING_FILTER = 0
const TAG_LABEL_EXPRESSION = 1
const STATUS_FILTER_DEFINITION = 1
const tagLabelParts = tag?.fields?.name.split(':');
const tagLabelParts = tag?.fields?.name.split(':')
const statusFilter = tag ? filterData.filter[STATUS_FILTER_DEFINITION].options.filter((option: Filter) => option.id === tagLabelParts[TAG_LABEL_EXPRESSION]) : null
return statusFilter ? statusFilter[ONLY_MATCHING_FILTER].label : 'Unbekannt';
return statusFilter ? statusFilter[ONLY_MATCHING_FILTER].label : 'Unbekannt'
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment