TerminalOne
TerminalOne copied to clipboard
Add support for renaming a tab
Add support for renaming tabs in the terminal application.
-
State Management:
- Add a new state variable
tabTitles
inpackages/terminal/app/page.tsx
to store tab names. - Modify the
createTab
function to initialize the tab name. - Modify the
closeTab
function to remove the tab name. - Pass the
tabName
prop to theTab
component.
- Add a new state variable
-
Tab Component:
- Accept a
tabName
prop inpackages/terminal/components/Tab/index.tsx
. - Display the
tabName
in the tab. - Add an input field to allow users to rename the tab.
- Handle the input change event to update the tab name.
- Accept a
-
TitleBar Component:
- Update the title bar in
packages/terminal/components/TitleBar/index.tsx
to reflect the renamed tab. - Use the
tabName
prop to display the tab name in the title bar.
- Update the title bar in
-
TabContext:
- Add a function to handle tab renaming in
packages/terminal/hooks/TabContext.tsx
. - Update the context to include the tab renaming function.
- Add a function to handle tab renaming in
For more details, open the Copilot Workspace session.