mirror of
https://github.com/maputnik/editor.git
synced 2026-08-26 15:07:41 +00:00
25cf61a825
This probably confused some people in the past, since vector tiles won't even display an access denied image ;) Before (no information on access keys and where to get them): <img width="411" alt="image" src="https://github.com/user-attachments/assets/8820fb20-bda4-460c-9cc9-8fec5daa480d"> After (add links to providers in info callout + add a field for Stadia Maps API keys): <img width="395" alt="image" src="https://github.com/user-attachments/assets/91ee732c-b3f5-45f8-81a6-8d896a93f644"> --------- Co-authored-by: Harel M <harel.mazor@gmail.com> Co-authored-by: Joscha <34318751+josxha@users.noreply.github.com> Co-authored-by: Hugues Tavernier <hugues.tavernier@protonmail.com> Co-authored-by: Keitaroh Kobayashi <keita@kbys.me>
99 lines
2.7 KiB
TypeScript
99 lines
2.7 KiB
TypeScript
import React from 'react'
|
|
|
|
const headers = {
|
|
js: "JS",
|
|
android: "Android",
|
|
ios: "iOS",
|
|
macos: "macOS",
|
|
};
|
|
|
|
type DocProps = {
|
|
fieldSpec: {
|
|
doc?: string
|
|
values?: {
|
|
[key: string]: {
|
|
doc?: string
|
|
}
|
|
}
|
|
'sdk-support'?: {
|
|
[key: string]: typeof headers
|
|
}
|
|
docUrl?: string,
|
|
docUrlLinkText?: string
|
|
}
|
|
};
|
|
|
|
export default class Doc extends React.Component<DocProps> {
|
|
render () {
|
|
const {fieldSpec} = this.props;
|
|
|
|
const {doc, values, docUrl, docUrlLinkText} = fieldSpec;
|
|
const sdkSupport = fieldSpec['sdk-support'];
|
|
|
|
const renderValues = (
|
|
!!values &&
|
|
// HACK: Currently we merge additional values into the style spec, so this is required
|
|
// See <https://github.com/maplibre/maputnik/blob/main/src/components/PropertyGroup.jsx#L16>
|
|
!Array.isArray(values)
|
|
);
|
|
|
|
return (
|
|
<>
|
|
{doc &&
|
|
<div className="SpecDoc">
|
|
<div className="SpecDoc__doc" data-wd-key='spec-field-doc'>{doc}</div>
|
|
{renderValues &&
|
|
<ul className="SpecDoc__values">
|
|
{Object.entries(values).map(([key, value]) => {
|
|
return (
|
|
<li key={key}>
|
|
<code>{JSON.stringify(key)}</code>
|
|
<div>{value.doc}</div>
|
|
</li>
|
|
);
|
|
})}
|
|
</ul>
|
|
}
|
|
</div>
|
|
}
|
|
{sdkSupport &&
|
|
<div className="SpecDoc__sdk-support">
|
|
<table className="SpecDoc__sdk-support__table">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
{Object.values(headers).map(header => {
|
|
return <th key={header}>{header}</th>;
|
|
})}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{Object.entries(sdkSupport).map(([key, supportObj]) => {
|
|
return (
|
|
<tr key={key}>
|
|
<td>{key}</td>
|
|
{Object.keys(headers).map((k) => {
|
|
if (Object.prototype.hasOwnProperty.call(supportObj, k)) {
|
|
return <td key={k}>{supportObj[k as keyof typeof headers]}</td>;
|
|
}
|
|
else {
|
|
return <td key={k}>no</td>;
|
|
}
|
|
})}
|
|
</tr>
|
|
);
|
|
})}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
{docUrl && docUrlLinkText &&
|
|
<div className="SpecDoc__learn-more">
|
|
<a href={docUrl} target="_blank" rel="noreferrer">{docUrlLinkText}</a>
|
|
</div>
|
|
}
|
|
</>
|
|
);
|
|
}
|
|
}
|