File tree Expand file tree Collapse file tree 10 files changed +40
-25
lines changed
apps/desktop/src/components Expand file tree Collapse file tree 10 files changed +40
-25
lines changed Original file line number Diff line number Diff line change 5555 const aiService = inject (AI_SERVICE );
5656 const stackService = inject (STACK_SERVICE );
5757 const forge = inject (DEFAULT_FORGE_FACTORY );
58+ const prService = $derived (forge .current .prService );
59+ const prUnit = $derived (prService ?.unit );
5860 const promptService = inject (PROMPT_SERVICE );
5961 const urlService = inject (URL_SERVICE );
6062 const clipboardService = inject (CLIPBOARD_SERVICE );
303305 <ReduxResult {projectId } {stackId } result ={prQuery ?.result }>
304306 {#snippet children (pr )}
305307 <ContextMenuSection >
306- <ContextMenuItemSubmenu label =" Pull Request" icon =" pr" >
308+ <ContextMenuItemSubmenu label ={ prUnit ?. name ?? ' Pull Request' } icon =" pr" >
307309 {#snippet submenu ({ close: closeSubmenu })}
308310 <ContextMenuSection >
309311 <ContextMenuItem
310- label =" Open PR in browser"
312+ label ="Open { prUnit ?. abbr ?? ' PR ' } in browser"
311313 testId ={TestId .BranchHeaderContextMenu_OpenPRInBrowser }
312314 onclick ={() => {
313315 urlService .openExternalUrl (pr .htmlUrl );
316318 }}
317319 />
318320 <ContextMenuItem
319- label =" Copy PR link"
321+ label ="Copy { prUnit ?. abbr ?? ' PR ' } link"
320322 testId ={TestId .BranchHeaderContextMenu_CopyPRLink }
321323 onclick ={() => {
322- clipboardService .write (pr .htmlUrl , { message: ' PR link copied' });
324+ clipboardService .write (pr .htmlUrl , {
325+ message: ` ${prUnit ?.abbr ?? ' PR' } link copied `
326+ });
323327 closeSubmenu ();
324328 close ();
325329 }}
Original file line number Diff line number Diff line change 2828 const forge = inject (DEFAULT_FORGE_FACTORY );
2929 const prService = $derived (forge .current .prService );
3030 const reviewUnit = $derived (prService ?.unit .abbr );
31+ const reviewUnitName = $derived (prService ?.unit .name ?? ' Pull request' );
3132
3233 const canPublishPR = $derived (!! canPublishReviewPlugin ?.imports .canPublishPR );
3334
4950 <Modal
5051 width =" small"
5152 type =" warning"
52- title =" Create Pull Request "
53+ title ="Create { reviewUnitName } "
5354 bind:this ={confirmCreatePrModal }
5455 onSubmit ={() => {
5556 modal ?.show ();
5657 }}
5758 >
5859 <p class =" text-13 text-body helper-text" >
59- It's strongly recommended to create pull requests starting with the branch at the base of the
60- stack.
60+ It's strongly recommended to create { reviewUnitName . toLowerCase ()}s starting with the branch
61+ at the base of the stack.
6162 <br />
62- Do you still want to create this pull request ?
63+ Do you still want to create this { reviewUnitName . toLowerCase ()} ?
6364 </p >
6465 {#snippet controls (close )}
6566 <Button kind ="outline" onclick ={close }>Cancel</Button >
66- <Button style =" warning" type =" submit" >Create Pull Request </Button >
67+ <Button style ="warning" type ="submit" >Create { reviewUnitName } </Button >
6768 {/ snippet }
6869 </Modal >
6970
Original file line number Diff line number Diff line change 334334 icon =" workbench"
335335 onclick ={applyFromFork }
336336 >
337- Apply PR to workspace
337+ Apply { prUnit ?. abbr ?? ' PR ' } to workspace
338338 </Button >
339339 {/if }
340340 </div >
Original file line number Diff line number Diff line change 110110
111111 <Modal
112112 testId ={TestId .BranchesView_CreateRemoteModal }
113- title =" Apply Pull Request"
113+ title ="Apply { prUnit ?. name ?? ' Pull Request' } "
114114 width =" small"
115115 bind:this ={createRemoteModal }
116116 onSubmit ={async () => await handleConfirmRemote (pr )}
Original file line number Diff line number Diff line change 2323 const prService = $derived (forge .current .prService );
2424 const prQuery = $derived (prNumber ? prService ?.get (prNumber ) : undefined );
2525 const pr = $derived (prQuery ?.response );
26+ const reviewUnitName = $derived (prService ?.unit .name ?? ' Pull request' );
2627
2728 const canPublishPR = $derived (forge .current .authenticated && ! pr );
2829
29- const ctaLabel = ' Create Pull Request… ' ;
30+ const ctaLabel = $derived ( ` Create ${ reviewUnitName }… ` ) ;
3031
3132 export const imports = {
3233 get allowedToPublishPR() {
Original file line number Diff line number Diff line change 1717 const prService = $derived (forge .current .prService );
1818 const prQuery = $derived (prService ?.get (prNumber , { forceRefetch: true }));
1919 const unitSymbol = $derived (prService ?.unit .symbol ?? ' ' );
20+ const unitAbbr = $derived (prService ?.unit .abbr ?? ' PR' );
2021 </script >
2122
2223<ReduxResult result ={prQuery ?.result } {projectId } {onerror }>
2324 {#snippet children (pr )}
2425 <Drawer testId ={TestId .PRBranchDrawer } persistId ="pr-branch-drawer- {projectId }- {pr .number }" >
2526 {#snippet header ()}
2627 <h3 class =" text-14 text-semibold truncate" >
27- <span class ="clr-text-2" >PR {unitSymbol }{pr .number }:</span >
28+ <span class ="clr-text-2" >{ unitAbbr } {unitSymbol }{pr .number }:</span >
2829 <span > {pr .title }</span >
2930 </h3 >
3031 {/ snippet }
Original file line number Diff line number Diff line change 126126 <ContextMenuItem
127127 label =" Copy link"
128128 onclick ={() => {
129- clipboardService .write (pr .htmlUrl , { message: ' PR link copied' });
129+ clipboardService .write (pr .htmlUrl , { message: ` ${ abbr } link copied` });
130130 contextMenuEl ?.close ();
131131 }}
132132 />
179179 icon =" copy-small"
180180 tooltip ="Copy {abbr } link"
181181 onclick ={() => {
182- clipboardService .write (pr .htmlUrl , { message: ' PR link copied' });
182+ clipboardService .write (pr .htmlUrl , { message: ` ${ abbr } link copied` });
183183 }}
184184 />
185185 <Button
Original file line number Diff line number Diff line change 5757 const baseBranchName = $derived (baseBranch ?.shortName );
5858 const forge = inject (DEFAULT_FORGE_FACTORY );
5959 const prService = $derived (forge .current .prService );
60+ const prUnit = $derived (prService ?.unit );
6061 const stackService = inject (STACK_SERVICE );
6162 const aiService = inject (AI_SERVICE );
6263 const remotesService = inject (REMOTES_SERVICE );
423424 onClose ();
424425 }
425426 })}
426- placeholder =" PR title"
427+ placeholder =" { prUnit ?. abbr ?? ' PR ' } title"
427428 showCount ={false }
428429 oninput ={imeHandler .handleInput ((e : Event ) => {
429430 const target = e .target as HTMLInputElement ;
439440 initialValue ={$prBody }
440441 enableFileUpload
441442 enableSmiles
442- placeholder =" PR Description"
443+ placeholder =" { prUnit ?. abbr ?? ' PR ' } Description"
443444 messageType =" pr"
445+ reviewUnitAbbr ={prUnit ?.abbr }
444446 {onAiButtonClick }
445447 {canUseAI }
446448 {aiIsLoading }
Original file line number Diff line number Diff line change 6161 forceSansFont? : boolean ;
6262 useRuler? : boolean ;
6363 messageType: ' commit' | ' pr' ;
64+ reviewUnitAbbr? : string ;
6465 }
6566
6667 let {
8081 testId,
8182 forceSansFont,
8283 useRuler,
83- messageType
84+ messageType,
85+ reviewUnitAbbr
8486 }: Props = $props ();
8587
8688 const MIN_RULER_VALUE = 30 ;
230232 medium: 320
231233 };
232234
233- const GENERATE_MESSAGES : Record < typeof messageType , string > = {
235+ const generateMessages = $derived . by (() => ( {
234236 commit: ' Generate commit message' ,
235- pr: ' Generate PR description'
236- };
237+ pr: ` Generate ${ reviewUnitAbbr ?? ' PR ' } description `
238+ })) ;
237239
238240 function getTooltipText(): string | undefined {
239241 if (! canUseAI ) {
240242 return ' You need to enable AI in the project settings to use this feature' ;
241243 }
242244 if (currentEditorWidth <= DROPDOWN_BTN_BREAKPOINTS .medium ) {
243- return GENERATE_MESSAGES [messageType ];
245+ return generateMessages [messageType ];
244246 }
245247 return undefined ;
246248 }
Original file line number Diff line number Diff line change 11<script lang =" ts" >
22 import GithubIntegration from ' $components/GithubIntegration.svelte' ;
33 import { SETTINGS_SERVICE } from ' $lib/config/appSettingsV2' ;
4+ import { DEFAULT_FORGE_FACTORY } from ' $lib/forge/forgeFactory.svelte' ;
45 import { inject } from ' @gitbutler/core/context' ;
56 import { CardGroup , Spacer , Toggle } from ' @gitbutler/ui' ;
67
78 const settingsService = inject (SETTINGS_SERVICE );
89 const appSettings = settingsService .appSettings ;
10+ const forge = inject (DEFAULT_FORGE_FACTORY );
11+ const prService = $derived (forge .current .prService );
12+ const prUnit = $derived (prService ?.unit );
913
1014 async function toggleAutoFillPrDescription() {
1115 await settingsService .updateReviews ({
2024
2125<CardGroup .Item labelFor =" autoFillPrDescription" >
2226 {#snippet title ()}
23- Auto-fill PR descriptions from commit
27+ Auto-fill { prUnit ?. abbr ?? ' PR ' } descriptions from commit
2428 {/ snippet }
2529 {#snippet caption ()}
26- When creating a pull request for a branch with just one commit, automatically use that commit's
27- message as the PR title and description.
30+ When creating a { prUnit ?. name . toLowerCase () ?? ' pull request' } for a branch with just one commit,
31+ automatically use that commit's message as the { prUnit ?. abbr ?? ' PR ' } title and description.
2832 {/ snippet }
2933 {#snippet actions ()}
3034 <Toggle
You can’t perform that action at this time.
0 commit comments