Skip to content

Commit

Permalink
chore: Add TSDoc and remove debug code
Browse files Browse the repository at this point in the history
In adding more TSDoc it triggered a new bug in storybook (see storybookjs/storybook#15067 ) which will hopefully be fixed in the next minor release (6.3). But this means the storybook documentation feature has been disabled and this also impacts on the automatic generation of controls.
  • Loading branch information
edalex-ian committed Jun 10, 2021
1 parent ad0a8de commit d843fd9
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 9 deletions.
9 changes: 8 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ module.exports = {
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials"
]
],
// Temporarily disabling while experiencing this issue:
// - https://github.com/storybookjs/storybook/issues/15067
// - https://github.com/styleguidist/react-docgen-typescript/issues/356
// Looks like might be fixed in Storybook 6.3
typescript: {
reactDocgen: 'none',
}
}
13 changes: 7 additions & 6 deletions src/KalturaUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ const MediaTypes = {
},
};

/**
* Supported options for types of media.
*/
type MediaTypeOptions = typeof MediaTypes.audio | typeof MediaTypes.video;

/**
Expand All @@ -69,6 +72,10 @@ export interface KalturaUploaderProps {
partnerId: number;
}

/**
* A component which provides a guided method to uploading a single media asset and creating a basic
* Media Entry in Kaltura.
*/
export const KalturaUploader = ({
endpoint,
ks,
Expand Down Expand Up @@ -124,12 +131,6 @@ export const KalturaUploader = ({

return (
<div id={kalturaUploaderId}>
<strong>This is the Kaltura Uploader!!</strong>
<p>endpoint: {endpoint}</p>
<p>ks: {ks}</p>
<p>partnerId: {partnerId}</p>
<hr />

{state.id === "start" && (
<>
{mediaTypeSelector}
Expand Down
23 changes: 21 additions & 2 deletions src/Metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,33 @@ export interface MetadataProps {
* A prefix to add to the DOM `id` for the root of this component.
*/
idPrefix: string;
/**
* A `KaltruaClient` that has been setup with valid session token and partner ID, possibly using
* `createClient` from `KalturaModule`.
*/
kClient: KalturaClient;
/**
* The media type for the Media Entry which is to be created - typically matching the type of file
* uploaded which resulted in the value provided for `uploadResult`.
*/
mediaType: KalturaMediaType;
/**
* Callback triggered on the successful creation of the Media Entry.
*
* @param entry Details returned from the server for the new Media Entry.
*/
onEntryCreated: (entry: KalturaMediaEntry) => void;
/**
* The result of a previously successful upload - such as one completed with the `Upload`
* component.
*/
uploadResult: KalturaUploadToken;
}

/**
* Having already uploaded a media file to Kaltura, this component then allows for the configuration
* of some basic metadata and the creation of an enclosing Media Entry on Kaltura.
*/
export const Metadata = ({
idPrefix,
kClient,
Expand All @@ -42,8 +63,6 @@ export const Metadata = ({
if (!entry) {
throw new Error("Failed to create new Media Entry!");
}
console.log("FINAL RESULT");
console.log(entry);

onEntryCreated(entry);
};
Expand Down
13 changes: 13 additions & 0 deletions src/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,23 @@ export interface UploadProps {
* A prefix to add to the DOM `id` for the root of this component.
*/
idPrefix: string;
/**
* A `KaltruaClient` that has been setup with valid session token and partner ID, possibly using
* `createClient` from `KalturaModule`.
*/
kClient: KalturaClient;
/**
* Callback to be triggered upon a successful file upload.
*
* @param uploadResult details returned from the server about the upload attempt.
*/
onUploadSuccessful: (uploadResult: KalturaUploadToken) => void;
}

/**
* A component providing a file selector and then integration to upload to a Kaltura instance
* configured by the provided `KalturaClient`.
*/
export const Upload = ({
allowedTypes,
idPrefix,
Expand Down

0 comments on commit d843fd9

Please sign in to comment.