Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch API docs URL and display in package details box #8329

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/components/platformSdkDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {Fragment} from 'react';
import styled from '@emotion/styled';
import {graphql, useStaticQuery} from 'gatsby';

Expand All @@ -14,6 +14,7 @@ const query = graphql`
url
repoUrl
version
apiDocsUrl
}
}
}
Expand Down Expand Up @@ -79,8 +80,16 @@ export function PlatformSdkDetail() {
<dd>{packageData.version}</dd>
<dt>Repository:</dt>
<dd>
<SmartLink to={packageData.repoUrl} />
<SmartLink to={packageData.repoUrl} target="_blank" />
</dd>
{packageData.apiDocsUrl && (
<Fragment>
<dt>API Documentation:</dt>
<dd>
<SmartLink to={packageData.apiDocsUrl} target="_blank" />
</dd>
</Fragment>
)}
</dl>
</PackageDetail>
);
Expand Down
1 change: 1 addition & 0 deletions src/gatsby/createSchemaCustomization/packageSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const getPackageTypeDefs = () => {
url: String
repoUrl: String!
version: String!
apiDocsUrl: String
files: [PackageFile!]
}
`,
Expand Down
1 change: 1 addition & 0 deletions src/gatsby/sourceNodes/appRegistryNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const sourceAppRegistryNodes = async ({
version: appData.version,
url: appData.package_url,
repoUrl: appData.repo_url,
apiDocsUrl: appData.api_docs_url,
files: appData.files
? Object.entries(appData.files).map(([fileName, fileData]: [string, any]) =>
fileData.checksums
Expand Down
2 changes: 2 additions & 0 deletions src/gatsby/sourceNodes/packageRegistryNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const sourcePackageRegistryNodes = async ({
version: sdkData.version,
url: sdkData.package_url,
repoUrl: sdkData.repo_url,
apiDocsUrl: sdkData.api_docs_url,
files: sdkData.files
? Object.entries(sdkData.files).map(([fileName, fileData]: [string, any]) =>
fileData.checksums
Expand All @@ -34,6 +35,7 @@ export const sourcePackageRegistryNodes = async ({
};

const content = JSON.stringify(data);

const nodeMeta = {
id: sdkName,
parent: null,
Expand Down
1 change: 1 addition & 0 deletions src/gatsby/utils/genericRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type VersionData = {
name: string;
repo_url: string;
version: string;
api_docs_url?: string;
files?: {
[name: string]: FileData;
};
Expand Down
2 changes: 1 addition & 1 deletion src/types/platform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface Platform extends PlatformConfig {
*/
key: string;
/**
* Same as key. Use `title` for a human readable platform name.
* Same as key. Use `title` for a human-readable platform name.
*
* @see Platform.key
*/
Expand Down
Loading