Skip to content

Commit

Permalink
Move interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc committed Dec 18, 2024
1 parent 7ae520a commit 9bf770d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
5 changes: 2 additions & 3 deletions scripts/apps/authoring-react/fields/boolean/editor.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {ICommonFieldConfig, IEditorComponentProps} from 'superdesk-api';
import {IBooleanFieldValueOperational, ICommonFieldConfig, IEditorComponentProps} from 'superdesk-api';
import * as React from 'react';
import {Switch} from 'superdesk-ui-framework/react';
import {IValueOperational} from './interfaces';

type IProps = IEditorComponentProps<IValueOperational, ICommonFieldConfig, never>;
type IProps = IEditorComponentProps<IBooleanFieldValueOperational, ICommonFieldConfig, never>;

export class Editor extends React.PureComponent<IProps> {
render() {
Expand Down
11 changes: 9 additions & 2 deletions scripts/apps/authoring-react/fields/boolean/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import {
IBooleanFieldUserPreferences,
IBooleanFieldValueOperational,
IBooleanFieldValueStorage,
ICommonFieldConfig,
ICustomFieldType,
} from 'superdesk-api';
import {gettext} from 'core/utils';
import {Editor} from './editor';
import {IUserPreferences, IValueOperational, IValueStorage} from './interfaces';
import {Preview} from './preview';

type IBooleanField = ICustomFieldType<IValueOperational, IValueStorage, ICommonFieldConfig, IUserPreferences>;
type IBooleanField = ICustomFieldType<
IBooleanFieldValueOperational,
IBooleanFieldValueStorage,
ICommonFieldConfig,
IBooleanFieldUserPreferences
>;

export const getBooleanField = (): IBooleanField => {
return {
Expand Down
3 changes: 0 additions & 3 deletions scripts/apps/authoring-react/fields/boolean/interfaces.ts

This file was deleted.

7 changes: 4 additions & 3 deletions scripts/apps/authoring-react/fields/boolean/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as React from 'react';
import {ICommonFieldConfig, IPreviewComponentProps} from 'superdesk-api';
import {IValueOperational} from './interfaces';
import {IBooleanFieldValueOperational, ICommonFieldConfig, IPreviewComponentProps} from 'superdesk-api';
import {Switch} from 'superdesk-ui-framework/react';
import {noop} from 'lodash';

export class Preview extends React.PureComponent<IPreviewComponentProps<IValueOperational, ICommonFieldConfig>> {
export class Preview extends React.PureComponent<
IPreviewComponentProps<IBooleanFieldValueOperational, ICommonFieldConfig>
> {
render() {
return (
<Switch
Expand Down
5 changes: 5 additions & 0 deletions scripts/core/superdesk-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ declare module 'superdesk-api' {
export type IAttachmentsUserPreferences = never;
export type IAttachmentsConfig = ICommonFieldConfig;

// AUTHORING-REACT FIELD TYPES - boolean
export type IBooleanFieldValueOperational = boolean | null;
export type IBooleanFieldValueStorage = IValueOperational;
export type IBooleanFieldUserPreferences = never;

// AUTHORING-REACT FIELD TYPES - date

export type IDateValueOperational = string;
Expand Down

0 comments on commit 9bf770d

Please sign in to comment.