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(metadata-sidebar): pass areAiSuggestionsAvailable based on file ext #3675

Merged
merged 20 commits into from
Oct 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
82 changes: 82 additions & 0 deletions src/elements/content-sidebar/MetadataSidebarRedesign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,86 @@ import './MetadataSidebarRedesign.scss';
import MetadataInstanceEditor from './MetadataInstanceEditor';
import { convertTemplateToTemplateInstance } from './utils/convertTemplateToTemplateInstance';

const SUPPORTED_FILE_EXTENSIONS = new Set([
mhagmajer marked this conversation as resolved.
Show resolved Hide resolved
// Text-Based Documents
'as',
'as3',
'asm',
'bat',
'c',
'cc',
'cmake',
'cpp',
'cs',
'css',
'csv',
'cxx',
'diff',
'doc',
'docx',
'erb',
'gdoc',
'groovy',
'gsheet',
'h',
'haml',
'hh',
'htm',
'html',
'java',
'js',
'json',
'less',
'log',
'm',
'make',
'md',
'ml',
'mm',
'msg',
'ods',
'odt',
'pages',
'pdf',
'php',
'pl',
'properties',
'py',
'rb',
'rst',
'rtf',
'sass',
'scala',
'scm',
'script',
'sh',
'sml',
'sql',
'txt',
'vi',
'vim',
'webdoc',
'wpd',
'xhtml',
'xls',
'xlsb',
'xlsm',
'xlsx',
'xml',
'xsd',
'xsl',
'xbd',
'xdw',
'yaml',
// Presentations
'gslide',
'gslides',
'key',
'odp',
'ppt',
'pptx',
]);

const MARK_NAME_JS_READY = `${ORIGIN_METADATA_SIDEBAR_REDESIGN}_${EVENT_JS_READY}`;

mark(MARK_NAME_JS_READY);
Expand Down Expand Up @@ -145,6 +225,7 @@ function MetadataSidebarRedesign({
const showEmptyState = !showLoading && showTemplateInstances && templateInstances.length === 0 && !editingTemplate;
const showEditor = !showEmptyState && editingTemplate;
const showList = !showEditor && templateInstances.length > 0 && !editingTemplate;
const areBoxAiSuggestionsEnabled = SUPPORTED_FILE_EXTENSIONS.has(file?.extension);

return (
<SidebarContent
Expand All @@ -162,6 +243,7 @@ function MetadataSidebarRedesign({
)}
{editingTemplate && (
<MetadataInstanceEditor
areBoxAiSuggestionsEnabled={areBoxAiSuggestionsEnabled}
mhagmajer marked this conversation as resolved.
Show resolved Hide resolved
isBoxAiSuggestionsEnabled={isBoxAiSuggestionsEnabled}
isUnsavedChangesModalOpen={isUnsavedChangesModalOpen}
onCancel={() => setEditingTemplate(null)}
Expand Down
Loading