codacus commited on
Commit
356715c
·
1 Parent(s): 25e6bb3

minor bugfix

Browse files
app/commit.json CHANGED
@@ -1 +1 @@
1
- { "commit": "49b02dd885919e24a201f07b1a7b0fd0371b4f85" , "version": "0.0.1" }
 
1
+ { "commit": "25e6bb3e848b67c9337f1cca2779f1af6ddc8fed" }
app/components/settings/features/FeaturesTab.tsx CHANGED
@@ -65,7 +65,9 @@ export default function FeaturesTab() {
65
  className="flex-1 p-2 ml-auto rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus transition-all text-sm min-w-[100px]"
66
  >
67
  {PromptLibrary.getList().map((x) => (
68
- <option value={x.id}>{x.label}</option>
 
 
69
  ))}
70
  </select>
71
  </div>
 
65
  className="flex-1 p-2 ml-auto rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus transition-all text-sm min-w-[100px]"
66
  >
67
  {PromptLibrary.getList().map((x) => (
68
+ <option key={x.id} value={x.id}>
69
+ {x.label}
70
+ </option>
71
  ))}
72
  </select>
73
  </div>
app/components/sidebar/HistoryItem.tsx CHANGED
@@ -4,6 +4,7 @@ import * as Dialog from '@radix-ui/react-dialog';
4
  import { type ChatHistoryItem } from '~/lib/persistence';
5
  import WithTooltip from '~/components/ui/Tooltip';
6
  import { useEditChatDescription } from '~/lib/hooks';
 
7
 
8
  interface HistoryItemProps {
9
  item: ChatHistoryItem;
@@ -103,25 +104,31 @@ export function HistoryItem({ item, onDelete, onDuplicate, exportChat }: History
103
  );
104
  }
105
 
106
- const ChatActionButton = ({
107
- toolTipContent,
108
- icon,
109
- className,
110
- onClick,
111
- }: {
112
- toolTipContent: string;
113
- icon: string;
114
- className?: string;
115
- onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
116
- btnTitle?: string;
117
- }) => {
118
- return (
119
- <WithTooltip tooltip={toolTipContent}>
120
- <button
121
- type="button"
122
- className={`scale-110 mr-2 hover:text-bolt-elements-item-contentAccent ${icon} ${className ? className : ''}`}
123
- onClick={onClick}
124
- />
125
- </WithTooltip>
126
- );
127
- };
 
 
 
 
 
 
 
4
  import { type ChatHistoryItem } from '~/lib/persistence';
5
  import WithTooltip from '~/components/ui/Tooltip';
6
  import { useEditChatDescription } from '~/lib/hooks';
7
+ import { forwardRef, type ForwardedRef } from 'react';
8
 
9
  interface HistoryItemProps {
10
  item: ChatHistoryItem;
 
104
  );
105
  }
106
 
107
+ const ChatActionButton = forwardRef(
108
+ (
109
+ {
110
+ toolTipContent,
111
+ icon,
112
+ className,
113
+ onClick,
114
+ }: {
115
+ toolTipContent: string;
116
+ icon: string;
117
+ className?: string;
118
+ onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
119
+ btnTitle?: string;
120
+ },
121
+ ref: ForwardedRef<HTMLButtonElement>,
122
+ ) => {
123
+ return (
124
+ <WithTooltip tooltip={toolTipContent}>
125
+ <button
126
+ ref={ref}
127
+ type="button"
128
+ className={`scale-110 mr-2 hover:text-bolt-elements-item-contentAccent ${icon} ${className ? className : ''}`}
129
+ onClick={onClick}
130
+ />
131
+ </WithTooltip>
132
+ );
133
+ },
134
+ );
app/lib/runtime/action-runner.ts CHANGED
@@ -202,8 +202,9 @@ export class ActionRunner {
202
  }
203
 
204
  const webcontainer = await this.#webcontainer;
 
205
 
206
- let folder = nodePath.dirname(action.filePath);
207
 
208
  // remove trailing slashes
209
  folder = folder.replace(/\/+$/g, '');
@@ -218,8 +219,8 @@ export class ActionRunner {
218
  }
219
 
220
  try {
221
- await webcontainer.fs.writeFile(action.filePath, action.content);
222
- logger.debug(`File written ${action.filePath}`);
223
  } catch (error) {
224
  logger.error('Failed to write file\n\n', error);
225
  }
 
202
  }
203
 
204
  const webcontainer = await this.#webcontainer;
205
+ const relativePath = nodePath.relative(webcontainer.workdir, action.filePath);
206
 
207
+ let folder = nodePath.dirname(relativePath);
208
 
209
  // remove trailing slashes
210
  folder = folder.replace(/\/+$/g, '');
 
219
  }
220
 
221
  try {
222
+ await webcontainer.fs.writeFile(relativePath, action.content);
223
+ logger.debug(`File written ${relativePath}`);
224
  } catch (error) {
225
  logger.error('Failed to write file\n\n', error);
226
  }