mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-08-03 09:31:52 +00:00
Upgrade prettier and fix files
This commit is contained in:
@@ -25,7 +25,7 @@ export function AdditionalFiles({files}: Props) {
|
||||
</a>
|
||||
</List.Header>
|
||||
<List.Description>
|
||||
{file.titl && <div>{file.titl}</div>}
|
||||
{file.titl && <div>{file.titl}</div>}
|
||||
</List.Description>
|
||||
</List.Content>
|
||||
</List.Item>
|
||||
|
||||
@@ -11,13 +11,13 @@ import {
|
||||
getNonImageFileEntry,
|
||||
mapToSource,
|
||||
} from '../../util/gedcom_util';
|
||||
import {FileEntry, AdditionalFiles} from './additional-files';
|
||||
import {Config, Ids} from '../config/config';
|
||||
import {AdditionalFiles, FileEntry} from './additional-files';
|
||||
import {ALL_SUPPORTED_EVENT_TYPES, Events} from './events';
|
||||
import {MultilineText} from './multiline-text';
|
||||
import {Sources} from './sources';
|
||||
import {TranslatedTag} from './translated-tag';
|
||||
import {WrappedImage} from './wrapped-image';
|
||||
import {Config, Ids} from '../config/config';
|
||||
|
||||
const EXCLUDED_TAGS = [
|
||||
...ALL_SUPPORTED_EVENT_TYPES,
|
||||
@@ -61,32 +61,30 @@ function attributeDetails(entry: GedcomEntry) {
|
||||
}
|
||||
|
||||
const attributeName = entry.tree
|
||||
.filter((subentry) => subentry.tag === 'TYPE')
|
||||
.flatMap((type) => getData(type))
|
||||
.join()
|
||||
.trim();
|
||||
.filter((subentry) => subentry.tag === 'TYPE')
|
||||
.flatMap((type) => getData(type))
|
||||
.join()
|
||||
.trim();
|
||||
|
||||
const attributeValue = getData(entry).join(' ').trim();
|
||||
if(attributeName) {
|
||||
if (attributeName) {
|
||||
return (
|
||||
<>
|
||||
<Header sub>
|
||||
<TranslatedTag tag={entry.tag}/>
|
||||
</Header>
|
||||
<div>
|
||||
<b>{attributeName}</b>: {attributeValue}
|
||||
</div>
|
||||
</>
|
||||
<>
|
||||
<Header sub>
|
||||
<TranslatedTag tag={entry.tag} />
|
||||
</Header>
|
||||
<div>
|
||||
<b>{attributeName}</b>: {attributeValue}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
<Header sub>
|
||||
<TranslatedTag tag={entry.tag}/>
|
||||
<TranslatedTag tag={entry.tag} />
|
||||
</Header>
|
||||
<div>
|
||||
{attributeValue}
|
||||
</div>
|
||||
<div>{attributeValue}</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -142,7 +140,9 @@ function sourceDetails(
|
||||
function fileDetails(objectEntries: GedcomEntry[], gedcom: GedcomData) {
|
||||
const files: FileEntry[] = [];
|
||||
objectEntries
|
||||
.map((objectEntry) => dereference(objectEntry, gedcom, (gedcom) => gedcom.other))
|
||||
.map((objectEntry) =>
|
||||
dereference(objectEntry, gedcom, (gedcom) => gedcom.other),
|
||||
)
|
||||
.forEach((objectEntry) => {
|
||||
const fileEntry = getNonImageFileEntry(objectEntry);
|
||||
if (fileEntry) {
|
||||
@@ -150,7 +150,7 @@ function fileDetails(objectEntries: GedcomEntry[], gedcom: GedcomData) {
|
||||
url: fileEntry.data,
|
||||
filename: getFileName(fileEntry),
|
||||
titl: objectEntry.tree.find((entry) => entry.tag === 'TITL')?.data,
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -314,14 +314,16 @@ function getOtherSections(entries: GedcomEntry[], gedcom: GedcomData) {
|
||||
));
|
||||
}
|
||||
|
||||
function getSectionForId(indi: string) : React.ReactNode {
|
||||
function getSectionForId(indi: string): React.ReactNode {
|
||||
return (
|
||||
<Item>
|
||||
<Item.Content>
|
||||
<Header sub>
|
||||
<FormattedMessage id="config.ids" defaultMessage="Identification" />
|
||||
</Header>
|
||||
<div><i>{indi}</i></div>
|
||||
<div>
|
||||
<i>{indi}</i>
|
||||
</div>
|
||||
</Item.Content>
|
||||
</Item>
|
||||
);
|
||||
@@ -354,10 +356,10 @@ export function Details(props: Props) {
|
||||
<Events gedcom={props.gedcom} entries={entries} indi={props.indi} />
|
||||
{props.config.id === Ids.SHOW ? getSectionForId(props.indi) : null}
|
||||
{getSectionForEachMatchingEntry(
|
||||
entries,
|
||||
props.gedcom,
|
||||
['FACT'],
|
||||
attributeDetails,
|
||||
entries,
|
||||
props.gedcom,
|
||||
['FACT'],
|
||||
attributeDetails,
|
||||
)}
|
||||
{getOtherSections(entries, props.gedcom)}
|
||||
{getSectionForEachMatchingEntry(
|
||||
|
||||
@@ -11,8 +11,17 @@ interface Props {
|
||||
export function LinkifyNewTab({children}: Props) {
|
||||
return (
|
||||
<Linkify
|
||||
componentDecorator={(decoratedHref: string, decoratedText: string, key: number) => (
|
||||
<a href={decoratedHref} key={key} target="_blank" rel="noopener noreferrer">
|
||||
componentDecorator={(
|
||||
decoratedHref: string,
|
||||
decoratedText: string,
|
||||
key: number,
|
||||
) => (
|
||||
<a
|
||||
href={decoratedHref}
|
||||
key={key}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{decoratedText}
|
||||
</a>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user