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

feat(console): add complete tutorial doc links for app guide #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions packages/console/src/assets/docs/guides/m2m-general/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
description: 'Enables direct communication between machines.',
target: ApplicationType.MachineToMachine,
isFeatured: true,
fullTutorial: {
title: 'Full machine-to-machine integration tutorial',
url: 'https://docs.logto.io/sdk/m2m',
},
});

export default metadata;
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
repo: 'kotlin',
path: 'android-sample-kotlin',
},
fullTutorial: {
title: 'Full Android SDK tutorial',
url: 'https://docs.logto.io/sdk/android',
},
});

export default metadata;
4 changes: 4 additions & 0 deletions packages/console/src/assets/docs/guides/spa-react/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
path: 'packages/react-sample',
},
isFeatured: true,
fullTutorial: {
title: 'Full React SDK tutorial',
url: 'https://docs.logto.io/sdk/react',
},
});

export default metadata;
4 changes: 4 additions & 0 deletions packages/console/src/assets/docs/guides/spa-vanilla/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
repo: 'js',
path: 'packages/browser-sample',
},
fullTutorial: {
title: 'Full vanilla JS SDK tutorial',
url: 'https://docs.logto.io/sdk/vanilla-js',
},
});

export default metadata;
4 changes: 4 additions & 0 deletions packages/console/src/assets/docs/guides/spa-vue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
path: 'packages/vue-sample',
},
isFeatured: true,
fullTutorial: {
title: 'Full Vue SDK tutorial',
url: 'https://docs.logto.io/sdk/vue',
},
});

export default metadata;
6 changes: 6 additions & 0 deletions packages/console/src/assets/docs/guides/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export type GuideMetadata = {

/** Indicate whether the application is for third-party use */
isThirdParty?: boolean;

/** The related complete tutorial doc for this guide which will be displayed in the 'Further readings' section. */
fullTutorial?: {
title: string;
url: string;
};
};

/** The guide instance to build in the console. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
repo: 'csharp',
path: '/',
},
fullTutorial: {
title: 'Full .NET Core (Blazor Server) integration tutorial',
url: 'https://docs.logto.io/sdk/dotnet-core/blazor-server',
},
});

export default metadata;
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
repo: 'csharp',
path: '/',
},
fullTutorial: {
title: 'Full .NET Core (Blazor WASM) integration tutorial',
url: 'https://docs.logto.io/sdk/dotnet-core/blazor-wasm',
},
});

export default metadata;
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
repo: 'csharp',
path: '/',
},
fullTutorial: {
title: 'Full .NET Core (MVC) integration tutorial',
url: 'https://docs.logto.io/sdk/dotnet-core/mvc',
},
});

export default metadata;
4 changes: 4 additions & 0 deletions packages/console/src/assets/docs/guides/web-express/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
repo: 'js',
path: 'packages/express-sample',
},
fullTutorial: {
title: 'Full Express SDK tutorial',
url: 'https://docs.logto.io/sdk/express',
},
});

export default metadata;
4 changes: 4 additions & 0 deletions packages/console/src/assets/docs/guides/web-go/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
repo: 'go',
path: 'gin-sample',
},
fullTutorial: {
title: 'Full Go SDK tutorial',
url: 'https://docs.logto.io/sdk/go',
},
});

export default metadata;
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
repo: 'js',
path: 'packages/next-app-dir-sample',
},
fullTutorial: {
title: 'Full Next.js App Router SDK tutorial',
url: 'https://docs.logto.io/sdk/next-app-router',
},
});

export default metadata;
4 changes: 4 additions & 0 deletions packages/console/src/assets/docs/guides/web-next/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
path: 'packages/next-sample',
},
isFeatured: true,
fullTutorial: {
title: 'Full Next.js SDK tutorial',
url: 'https://docs.logto.io/sdk/next',
},
});

export default metadata;
4 changes: 4 additions & 0 deletions packages/console/src/assets/docs/guides/web-php/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
name: 'PHP',
description: 'Integrate Logto into your PHP web app, such as Lavarel.',
target: ApplicationType.Traditional,
fullTutorial: {
title: 'Full PHP SDK tutorial',
url: 'https://docs.logto.io/sdk/php',
},
});

export default metadata;
4 changes: 4 additions & 0 deletions packages/console/src/assets/docs/guides/web-python/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const metadata: Readonly<GuideMetadata> = Object.freeze({
repo: 'python',
path: 'samples',
},
fullTutorial: {
title: 'Full Python SDK tutorial',
url: 'https://docs.logto.io/sdk/python',
},
});

export default metadata;
15 changes: 13 additions & 2 deletions packages/console/src/mdx-components/Steps/FurtherReadings.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import { type Ref, forwardRef } from 'react';

import { type GuideMetadata } from '@/assets/docs/guides/types';
import TextLink from '@/ds-components/TextLink';

import Step, { type Props as StepProps } from '../Step';

type Props = Omit<StepProps, 'children'>;
type Props = Omit<StepProps, 'children'> & {
fullTutorial: GuideMetadata['fullTutorial'];
};

function FurtherReadings(props: Props, ref?: Ref<HTMLDivElement>) {
const { fullTutorial, ...stepProps } = props;
return (
<Step ref={ref} {...props}>
<Step ref={ref} {...stepProps}>
<ul>
{fullTutorial && (
<li>
<TextLink href={fullTutorial.url} targetBlank="noopener">
{fullTutorial.title}
</TextLink>
</li>
)}
<li>
<TextLink href="https://docs.logto.io/docs/recipes/customize-sie/" targetBlank="noopener">
Customize sign-in experience
Expand Down
4 changes: 2 additions & 2 deletions packages/console/src/mdx-components/Steps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export default function Steps({ children: reactChildren }: Props) {
const isApiResourceGuide = metadata.target === 'API';

const furtherReadings = useMemo(
() => <FurtherReadings title="Further readings" subtitle="3 articles" />,
[]
() => <FurtherReadings title="Further readings" fullTutorial={metadata.fullTutorial} />,
[metadata.fullTutorial]
);
const children: Array<ReactElement<StepProps, typeof Step>> = useMemo(() => {
const steps = Array.isArray(reactChildren) ? reactChildren : [reactChildren];
Expand Down