| 1 | export interface ReviewPaneFileSelection { |
| 2 | readonly sectionId: string | null; |
| 3 | readonly fileId: string | null; |
| 4 | } |
| 5 | |
| 6 | export function resolveSelectedReviewFileId(input: { |
| 7 | readonly selection: ReviewPaneFileSelection; |
| 8 | readonly sectionId: string | null; |
| 9 | readonly availableFileIds: ReadonlyArray<string>; |
| 10 | }): string | null { |
| 11 | if (input.selection.sectionId !== input.sectionId || input.selection.fileId === null) { |
| 12 | return null; |
| 13 | } |
| 14 | |
| 15 | return input.availableFileIds.includes(input.selection.fileId) ? input.selection.fileId : null; |
| 16 | } |