Skip to content

Commit

Permalink
Tweaks on find window
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsage committed Aug 24, 2024
1 parent 5557553 commit 593242e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/modAssist_func_lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ const menu = {
sep : { type : 'separator' },

page_find : ( thisMod ) => [
menu.iconL10n('select_in_main', null, 'mod', {sublabel : thisMod.name} ),
menu.iconL10n('select_in_main', null, 'mod', {sublabel : thisMod.name, enabled : false} ),
menu.sep,
...thisMod.collect.map((x) => menu.icon(
`${x.name} :: ${x.version}`,
Expand Down
7 changes: 5 additions & 2 deletions modAssist_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ ipcMain.on('context:mod', async (event, modID, modIDs) => {
const isLog = thisMod.badgeArray.includes('log')

const template = [
funcLib.menu.icon(thisMod.fileDetail.shortName, null, 'mod'),
funcLib.menu.icon(thisMod.fileDetail.shortName, null, 'mod', { enabled : false }),
funcLib.menu.sep,
]

Expand Down Expand Up @@ -803,7 +803,7 @@ ipcMain.on('savetrack:folder', () => {

// MARK: save compare
ipcMain.on('dispatch:save', (_, collection) => { serveIPC.windowLib.createNamedWindow('save', { collectKey : collection }) })
ipcMain.on('select:listInMain', (_, selectList) => {
ipcMain.on('listInMain', (_, selectList) => {
if ( serveIPC.windowLib.isValid('main') ) {
serveIPC.windowLib.win.main.focus()
serveIPC.windowLib.sendToWindow('main', 'select:list', selectList)
Expand Down Expand Up @@ -861,6 +861,9 @@ ipcMain.on('dispatch:debug', () => {
// MARK: misc window.
ipcMain.on('dispatch:changelog', () => { serveIPC.windowLib.createNamedWindow('change') } )
ipcMain.on('dispatch:find', () => { serveIPC.windowLib.createNamedWindow('find') } )
ipcMain.on('select:withText', (_, id, txt) => {
serveIPC.windowLib.sendAndFocusValid('main', 'select:withText', id, txt)
})
ipcMain.on('dispatch:game', () => { funcLib.gameLauncher() })
ipcMain.on('dispatch:help', () => { shell.openExternal('https://fsgmodding.github.io/FSG_Mod_Assistant/') })
ipcMain.on('win:clipboard', (_, value) => clipboard.writeText(value, 'selection') )
Expand Down
2 changes: 1 addition & 1 deletion renderer/find.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@


<template id="version_entry">
<dt class="col-9 mb-1 overflow-hidden"><template-var>name</template-var></dt><dd class="col-3 mb-1 ps-1"><template-var>version</template-var></dd>
<dt class="col-9 mb-1 overflow-hidden" style="cursor: pointer; text-decoration: underline dotted;"><template-var>name</template-var></dt><dd class="col-3 mb-1 ps-1"><template-var>version</template-var></dd>
</template>

<template id="mod_entry">
Expand Down
7 changes: 4 additions & 3 deletions renderer/preload/preload-sharedWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ const pageAPI = {
},
'find' : {
functions : {
inputContext : () => ipcRenderer.send('context:cutCopyPaste'),
modContext : (data) => ipcRenderer.send('context:find', data),
all : () => ipcRenderer.invoke('collect:all'),
all : () => ipcRenderer.invoke('collect:all'),
inputContext : () => ipcRenderer.send('context:cutCopyPaste'),
modContext : (data) => ipcRenderer.send('context:find', data),
select : (id, txt) => ipcRenderer.send('select:withText', id, txt),
},
validAsync : new Set(['find:filterText']),
},
Expand Down
9 changes: 7 additions & 2 deletions renderer/renderJS/find_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class windowState {
author : DATA.escapeSpecial(mod.modDesc.author),
collect : [],
icon : mod.modDesc.iconImageCache,
id : mod.colUUID,
name : mod.fileDetail.shortName,
search : [
mod.fileDetail.shortName,
Expand Down Expand Up @@ -132,10 +133,14 @@ class windowState {

const itemCollectNode = itemNode.querySelector('.versionList')
for ( const cItem of item.collect ) {
itemCollectNode.appendChild(DATA.templateEngine('version_entry', {
const node = DATA.templateEngine('version_entry', {
name : cItem.name,
version : cItem.version,
}))
})
node.querySelector('dt').addEventListener('click', () => {
window.find_IPC.select(item.id, item.name)
})
itemCollectNode.appendChild(node)
}

itemNode.firstElementChild.addEventListener('contextmenu', () => {
Expand Down

0 comments on commit 593242e

Please sign in to comment.