Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Description

Converted Content.js to TypeScript in the content-picker element.

Changes made:

  • Renamed Content.js to Content.tsx
  • Converted Flow types to TypeScript interfaces
  • Improved type safety with proper function signatures
  • Removed Flow comments and simplified JSDoc

Link to Devin run: https://app.devin.ai/sessions/848dfdad3fe447138f3a218f3058e660
Requested by: [email protected]

- Renamed Content.js to Content.tsx
- Converted Flow types to TypeScript interfaces
- Improved type safety with proper function signatures
- Removed Flow comments and simplified JSDoc

Link to Devin run: https://app.devin.ai/sessions/848dfdad3fe447138f3a218f3058e660
Requested by: [email protected]
@devin-ai-integration devin-ai-integration bot requested a review from a team as a code owner February 20, 2025 20:14
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add "(aside)" to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

import ItemList from './ItemList';
import { VIEW_ERROR, VIEW_SELECTED } from '../../constants';
import type { View, Collection } from '../../common/types/core';
import { View, Collection } from '../../common/types/core';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you sort this?

Suggested change
import { View, Collection } from '../../common/types/core';
import { Collection, View } from '../../common/types/core';

Comment on lines 38 to 41
*
* @param {string} view the current view
* @param {Object} currentCollection the current collection
* @return {boolean} empty or not
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin please revert this change

- Sort imports alphabetically
- Restore JSDoc comments
tjuanitas
tjuanitas previously approved these changes Feb 20, 2025
Copy link
Contributor

@tjuanitas tjuanitas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't merge this yet, as the JS component could be useful for testing. however, it looks good and doesn't require any more changes.

Comment on lines 1 to 6
/**
* @flow
* @file File picker header and list component
* @author Box
*/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete this comment, you don't need the header comment at the top of the file

@@ -68,24 +65,22 @@ const Content = ({
<ProgressBar percent={currentCollection.percentLoaded} />
)}
{isEmpty(view, currentCollection) ? (
<EmptyView view={view} isLoading={currentCollection.percentLoaded !== 100} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you make this change?

canSetShareAccess,
onItemSelect,
onItemClick,
onShareAccessChange,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert these changes

onFocusChange={onFocusChange}
onShareAccessChange={onShareAccessChange}
onFocusChange={onFocusChange}
extensionsWhitelist={extensionsWhitelist}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert these changes

*/

import * as React from 'react';
// $FlowFixMe TypeScript file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert this change

Comment on lines 42 to 57
view,
rootId,
isSmall,
rootElement,
focusedRow,
hasHitSelectionLimit,
selectableType,
currentCollection,
tableRef,
canSetShareAccess,
isSingleSelect,
onItemClick,
onItemSelect,
onShareAccessChange,
onFocusChange,
extensionsWhitelist,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you sort this list alphabetically?

Comment on lines 67 to 82
view={view}
rootId={rootId}
isSmall={isSmall}
rootElement={rootElement}
focusedRow={focusedRow}
currentCollection={currentCollection}
tableRef={tableRef}
canSetShareAccess={canSetShareAccess}
hasHitSelectionLimit={hasHitSelectionLimit}
isSingleSelect={isSingleSelect}
selectableType={selectableType}
onItemSelect={onItemSelect}
onItemClick={onItemClick}
onFocusChange={onFocusChange}
onShareAccessChange={onShareAccessChange}
extensionsWhitelist={extensionsWhitelist}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you sort these props alphabetically?

<ProgressBar percent={currentCollection.percentLoaded} />
)}
{isEmpty(view, currentCollection) ? (
<EmptyView view={view} isLoading={currentCollection.percentLoaded !== 100} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you sort the props alphabetically?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<EmptyView view={view} isLoading={currentCollection.percentLoaded !== 100} />
<EmptyView isLoading={currentCollection.percentLoaded !== 100} view={view} />

@devin-ai-integration
Copy link
Contributor Author

Line-by-Line Comparison between Content.tsx and Content.js.flow

  1. File Header Changes (lines 1-5 in .js.flow removed):

    • Removed Flow header comment block
    /**
     * @flow
     * @file File picker header and list component
     * @author Box
     */
    
  2. Import Changes (lines 1-8):

    • Line 2: Removed Flow comment // TypeScript file
    • Line 6: Changed import type { View, Collection } to import { Collection, View }
    • Reordered imports alphabetically
  3. Type Definition Changes (lines 10-27):

    • Changed type Props = { to export interface ContentProps {
    • Changed comma separators to semicolons
    • Added specific function types:
      • onFocusChange: FunctiononFocusChange: (row: number) => void
      • onItemClick: FunctiononItemClick: (item: Record<string, unknown>) => void
      • onItemSelect: FunctiononItemSelect: (item: Record<string, unknown>) => void
      • onShareAccessChange: FunctiononShareAccessChange: (access: string) => void
      • tableRef: FunctiontableRef: (ref: HTMLElement) => void
  4. isEmpty Function Changes (lines 36-39):

    • Changed function isEmpty to const isEmpty =
    • Added arrow function syntax
    • Added explicit return type annotation : boolean =>
  5. Content Component Changes (lines 41-86):

    • Added explicit return type : React.ReactElement
    • Reordered props alphabetically in both the destructuring and JSX
    • Changed Props type to ContentProps in parameter type annotation
    • Reordered EmptyView props alphabetically
    • Reordered ItemList props alphabetically

The main structural changes were:

  1. Removal of Flow-specific syntax and comments
  2. Addition of more specific TypeScript type annotations
  3. Consistent alphabetical ordering of props
  4. Conversion to TypeScript interface syntax
  5. Addition of explicit return types

@devin-ai-integration
Copy link
Contributor Author

Line-by-Line Comparison between Content.tsx and Content.js.flow (Part 1)

  1. File Header Changes (lines 1-5 in .js.flow removed):

    • Removed Flow header comment block
    /**
     * @flow
     * @file File picker header and list component
     * @author Box
     */
    
  2. Import Changes (lines 1-8):

    • Line 2: Removed Flow comment // TypeScript file
    • Line 6: Changed import type { View, Collection } to import { Collection, View }
    • Reordered imports alphabetically

@devin-ai-integration
Copy link
Contributor Author

Line-by-Line Comparison (Part 2)

  1. Type Definition Changes (lines 10-27):
    • Changed type Props = { to export interface ContentProps {
    • Changed comma separators to semicolons
    • Added specific function types:
      • onFocusChange: FunctiononFocusChange: (row: number) => void
      • onItemClick: FunctiononItemClick: (item: Record<string, unknown>) => void
      • onItemSelect: FunctiononItemSelect: (item: Record<string, unknown>) => void
      • onShareAccessChange: FunctiononShareAccessChange: (access: string) => void
      • tableRef: FunctiontableRef: (ref: HTMLElement) => void

@devin-ai-integration
Copy link
Contributor Author

Line-by-Line Comparison (Part 3)

  1. isEmpty Function Changes (lines 36-39):

    • Changed function isEmpty to const isEmpty =
    • Added arrow function syntax
    • Added explicit return type annotation : boolean =>
  2. Content Component Changes (lines 41-86):

    • Added explicit return type : React.ReactElement
    • Reordered props alphabetically in both the destructuring and JSX
    • Changed Props type to ContentProps in parameter type annotation
    • Reordered EmptyView props alphabetically
    • Reordered ItemList props alphabetically

@devin-ai-integration
Copy link
Contributor Author

Line-by-Line Comparison (Summary)

The main structural changes were:

  1. Removal of Flow-specific syntax and comments
  2. Addition of more specific TypeScript type annotations
  3. Consistent alphabetical ordering of props
  4. Conversion to TypeScript interface syntax
  5. Addition of explicit return types

@devin-ai-integration
Copy link
Contributor Author

Closing due to inactivity.

@tjuanitas tjuanitas reopened this May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants