Skip to content

Commit 416e08a

Browse files
committed
Truncate description and open default file in workspace
1 parent 60eb59e commit 416e08a

File tree

4 files changed

+55
-22
lines changed

4 files changed

+55
-22
lines changed

libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function HomeTabFeaturedPlugins({ plugin }: HomeTabFeaturedPluginsProps) {
122122
<div className="w-100 align-items-end remixui_featuredplugins_container" id="hTFeaturedPlugins">
123123
<div className="d-flex justify-content-between align-items-center mb-2">
124124
<h6 style={{ color: isDark ? 'white' : 'black' }}>Most used plugins</h6>
125-
<button className="btn btn-secondary btn-sm">Explore all plugins</button>
125+
<button className="btn btn-secondary btn-sm" onClick={() => plugin.call('menuicons', 'select', 'pluginManager')} >Explore all plugins</button>
126126
</div>
127127
<div className="row">
128128
{

libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,31 @@ function HomeTabFile({ plugin }: HomeTabFileProps) {
6464
plugin.verticalIcons.select('filePanel')
6565
_paq.push(['trackEvent', 'hometab', 'filesSection', 'loadRecentWorkspace'])
6666
await plugin.call('filePanel', 'switchToWorkspace', { name: workspaceName, isLocalhost: false })
67+
const workspaceFiles = await plugin.call('fileManager', 'readdir', '/')
68+
69+
if (workspaceFiles['contracts'] && workspaceFiles['contracts'].isDirectory) {
70+
const contractFiles = await plugin.call('fileManager', 'readdir', '/contracts')
71+
const contractFilesArray = Object.keys(contractFiles)
72+
const contractFile = contractFilesArray[0]
73+
74+
!contractFiles[contractFile].isDirectory && await plugin.call('fileManager', 'open', contractFile)
75+
} else if (workspaceFiles['circuits'] && workspaceFiles['circuits'].isDirectory) {
76+
const circuitFiles = await plugin.call('fileManager', 'readdir', '/circuits')
77+
const circuitFilesArray = Object.keys(circuitFiles)
78+
const circuitFile = circuitFilesArray[0]
79+
80+
!circuitFiles[circuitFile].isDirectory && await plugin.call('fileManager', 'open', circuitFile)
81+
} else if (workspaceFiles['src'] && workspaceFiles['src'].isDirectory) {
82+
const srcFiles = await plugin.call('fileManager', 'readdir', '/src')
83+
const srcFilesArray = Object.keys(srcFiles)
84+
const srcFile = srcFilesArray[0]
85+
86+
!srcFiles[srcFile].isDirectory && await plugin.call('fileManager', 'open', srcFile)
87+
} else if (workspaceFiles['README.txt'] && !workspaceFiles['README.txt'].isDirectory) {
88+
await plugin.call('fileManager', 'open', '/README.txt')
89+
} else if (workspaceFiles['README.md'] && !workspaceFiles['README.md'].isDirectory) {
90+
await plugin.call('fileManager', 'open', '/README.md')
91+
}
6792
}
6893

6994
return (

libs/remix-ui/home-tab/src/lib/components/homeTabUpdates.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-unused-vars */
22
import React, { useContext } from 'react'
3-
import { FormattedMessage, useIntl } from 'react-intl'
43
import { ThemeContext } from '../themeContext'
54
import fetchResults from '../fetch.json'
65
import { RenderIf } from '@remix-ui/helper'
@@ -25,29 +24,33 @@ interface UpdateInfo {
2524
url?: string
2625
pluginName?: string
2726
pluginMethod?: string
28-
}
27+
},
28+
theme: string
2929
}
3030

3131
function HomeTabUpdates({ plugin }: HomeTabUpdatesProps) {
32-
const intl = useIntl()
3332
const theme = useContext(ThemeContext)
3433
const isDark = theme.name === 'dark'
3534

3635
function UpdateCard(updateInfo: UpdateInfo) {
3736
return (
3837
<div className="card mb-3">
3938
<div className="d-flex align-items-center p-3 overflow-hidden justify-content-between" style={{ height: '80px', backgroundColor: 'var(--body-bg)' }}>
40-
<span className="badge bg-info me-2 bg-transparent border p-2 rounded-pill text-ai" style={{ fontWeight: 'light', border: '1px solid var(--ai)' }}>{updateInfo.title}</span>
39+
<span className={`badge bg-info me-2 bg-transparent border p-2 rounded-pill text-${updateInfo.theme}`} style={{ fontWeight: 'light', border: `1px solid var(--${updateInfo.theme})` }}>{updateInfo.badge}</span>
4140
<img src={'assets/img/in-app-marketing-card-illustration.svg'} alt="RemixAI Assistant" className="me-2" style={{ height: '150px', width: '150px' }} />
4241
</div>
4342
<div className="p-3" style={{ fontSize: '1rem', zIndex: 1 }}>
44-
<span className="d-block mt-1 mb-2" style={{ color: isDark ? 'white' : 'black' }}>{updateInfo.badge}</span>
45-
<div className="mb-2 small">{updateInfo.description}</div>
43+
<span className="d-block mt-1 mb-2" style={{ color: isDark ? 'white' : 'black' }}>
44+
{updateInfo.title.length > 35 ? `${updateInfo.title.substring(0, 52)}...` : updateInfo.title}
45+
</span>
46+
<div className="mb-2 small">
47+
{updateInfo.description.length > 120 ? `${updateInfo.description.substring(0, 130)}...` : updateInfo.description}
48+
</div>
4649
<RenderIf condition={updateInfo.action.type === 'link'}>
47-
<a href={updateInfo.action.url} target="_blank" rel="noopener noreferrer" className="btn btn-secondary btn-sm w-100 text-ai text-decoration-none">{updateInfo.action.label}</a>
50+
<a href={updateInfo.action.url} target="_blank" rel="noopener noreferrer" className={`btn btn-secondary btn-sm w-100 text-${updateInfo.theme} text-decoration-none`}>{updateInfo.action.label}</a>
4851
</RenderIf>
4952
<RenderIf condition={updateInfo.action.type === 'methodCall'}>
50-
<button className="btn btn-secondary btn-sm w-100 text-ai" onClick={() => plugin.call(updateInfo.action.pluginName, updateInfo.action.pluginMethod)}>{updateInfo.action.label}</button>
53+
<button className={`btn btn-secondary btn-sm w-100 text-${updateInfo.theme}`} onClick={() => plugin.call(updateInfo.action.pluginName, updateInfo.action.pluginMethod)}>{updateInfo.action.label}</button>
5154
</RenderIf>
5255
</div>
5356
</div>
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
[{
22
"badge": "RemixAI Assistant",
3-
"title": "RemixAI Assistant",
4-
"description": "RemixAI Assistant is a tool that helps you write code faster and easier.",
3+
"title": "RemixAI Assistant is a tool that helps you write code faster and easier. RemixAI Assistant is a tool that helps you write code faster and easier. RemixAI Assistant is a tool that helps you write code faster and easier.",
4+
"description": "RemixAI Assistant is a tool that helps you write code faster and easier. RemixAI Assistant is a tool that helps you write code faster and easier. RemixAI Assistant is a tool that helps you write code faster and easier.",
55
"icon": "https://remix-ui.org/assets/remix-ai-assistant.png",
66
"action": {
77
"type": "methodCall",
88
"label": "Build with AI",
99
"pluginName": "remixAIAssistant",
1010
"pluginMethod": "activatePlugin"
11-
}
11+
},
12+
"theme": "ai"
1213
},
1314
{
1415
"badge": "v0.59.0 Release",
@@ -19,18 +20,21 @@
1920
"type": "link",
2021
"label": "Read more",
2122
"url": "https://remix-ui.org/releases/v0.59.0"
22-
}
23+
},
24+
"theme": "primary"
2325
},
2426
{
25-
"badge": "RemixUI v0.59.0 Release",
26-
"title": "RemixUI v0.59.0 Release",
27-
"description": "RemixUI v0.59.0 is now available. This release includes new features and improvements.",
28-
"icon": "https://remix-ui.org/assets/remix-ui-logo.png",
27+
"badge": "RemixAI Assistant",
28+
"title": "RemixAI Assistant",
29+
"description": "RemixAI Assistant is a tool that helps you write code faster and easier.",
30+
"icon": "https://remix-ui.org/assets/remix-ai-assistant.png",
2931
"action": {
30-
"type": "link",
31-
"label": "Read more",
32-
"url": "https://remix-ui.org/releases/v0.59.0"
33-
}
32+
"type": "methodCall",
33+
"label": "Build with AI",
34+
"pluginName": "remixAIAssistant",
35+
"pluginMethod": "activatePlugin"
36+
},
37+
"theme": "ai"
3438
},
3539
{
3640
"badge": "v0.59.0 Release",
@@ -41,6 +45,7 @@
4145
"type": "link",
4246
"label": "Read more",
4347
"url": "https://remix-ui.org/releases/v0.59.0"
44-
}
48+
},
49+
"theme": "primary"
4550
}
4651
]

0 commit comments

Comments
 (0)