Skip to content

Commit ce26569

Browse files
committed
Add contact buttons to QuickProjectWizardToolWindow for website and plugin access
1 parent 4b9f275 commit ce26569

1 file changed

Lines changed: 121 additions & 44 deletions

File tree

src/main/kotlin/com/github/cnrture/quickprojectwizard/toolwindow/QuickProjectWizardToolWindowFactory.kt

Lines changed: 121 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
77
import androidx.compose.material.Card
88
import androidx.compose.material.Icon
99
import androidx.compose.material.icons.Icons
10-
import androidx.compose.material.icons.filled.ColorLens
11-
import androidx.compose.material.icons.filled.FileOpen
12-
import androidx.compose.material.icons.filled.Settings
13-
import androidx.compose.material.icons.filled.ViewModule
10+
import androidx.compose.material.icons.filled.*
1411
import androidx.compose.runtime.*
1512
import androidx.compose.ui.Alignment
1613
import androidx.compose.ui.Modifier
@@ -30,6 +27,7 @@ import com.github.cnrture.quickprojectwizard.toolwindow.manager.colorpicker.Colo
3027
import com.github.cnrture.quickprojectwizard.toolwindow.manager.featuremaker.FeatureMakerContent
3128
import com.github.cnrture.quickprojectwizard.toolwindow.manager.modulemaker.ModuleMakerContent
3229
import com.github.cnrture.quickprojectwizard.toolwindow.manager.settings.SettingsContent
30+
import com.intellij.ide.BrowserUtil
3331
import com.intellij.openapi.project.Project
3432
import com.intellij.openapi.wm.ToolWindow
3533
import com.intellij.openapi.wm.ToolWindowFactory
@@ -99,56 +97,103 @@ class QuickProjectWizardToolWindowFactory : ToolWindowFactory {
9997
) {
10098
Card(
10199
modifier = Modifier
102-
.width(160.dp)
100+
.width(180.dp)
103101
.fillMaxHeight(),
104102
backgroundColor = QPWTheme.colors.gray,
105103
elevation = 8.dp
106104
) {
107105
Column(
108-
modifier = Modifier.padding(16.dp),
109-
verticalArrangement = Arrangement.spacedBy(12.dp),
106+
modifier = Modifier.fillMaxHeight()
110107
) {
111-
QPWText(
112-
text = "Quick Actions",
113-
color = QPWTheme.colors.white,
114-
style = TextStyle(
115-
fontSize = 18.sp,
116-
fontWeight = FontWeight.Bold,
117-
),
118-
modifier = Modifier.padding(bottom = 8.dp)
119-
)
108+
Column(
109+
modifier = Modifier
110+
.weight(1f)
111+
.padding(16.dp),
112+
verticalArrangement = Arrangement.spacedBy(12.dp)
113+
) {
114+
QPWText(
115+
text = "Quick Actions",
116+
color = QPWTheme.colors.white,
117+
style = TextStyle(
118+
fontSize = 18.sp,
119+
fontWeight = FontWeight.Bold,
120+
),
121+
modifier = Modifier.padding(bottom = 8.dp)
122+
)
120123

121-
SidebarButton(
122-
title = "Module",
123-
icon = Icons.Default.ViewModule,
124-
isSelected = selectedSection == "module",
125-
color = QPWTheme.colors.green,
126-
onClick = { selectedSection = "module" }
127-
)
124+
SidebarButton(
125+
title = "Module",
126+
icon = Icons.Default.ViewModule,
127+
isSelected = selectedSection == "module",
128+
color = QPWTheme.colors.green,
129+
onClick = { selectedSection = "module" }
130+
)
128131

129-
SidebarButton(
130-
title = "Feature",
131-
icon = Icons.Default.FileOpen,
132-
isSelected = selectedSection == "feature",
133-
color = QPWTheme.colors.red,
134-
onClick = { selectedSection = "feature" }
135-
)
132+
SidebarButton(
133+
title = "Feature",
134+
icon = Icons.Default.FileOpen,
135+
isSelected = selectedSection == "feature",
136+
color = QPWTheme.colors.red,
137+
onClick = { selectedSection = "feature" }
138+
)
136139

137-
SidebarButton(
138-
title = "Picker",
139-
icon = Icons.Default.ColorLens,
140-
isSelected = selectedSection == "color",
141-
color = QPWTheme.colors.purple,
142-
onClick = { selectedSection = "color" }
143-
)
140+
SidebarButton(
141+
title = "Picker",
142+
icon = Icons.Default.ColorLens,
143+
isSelected = selectedSection == "color",
144+
color = QPWTheme.colors.purple,
145+
onClick = { selectedSection = "color" }
146+
)
144147

145-
SidebarButton(
146-
title = "Settings",
147-
icon = Icons.Default.Settings,
148-
isSelected = selectedSection == "settings",
149-
color = QPWTheme.colors.lightGray,
150-
onClick = { selectedSection = "settings" }
151-
)
148+
SidebarButton(
149+
title = "Settings",
150+
icon = Icons.Default.Settings,
151+
isSelected = selectedSection == "settings",
152+
color = QPWTheme.colors.lightGray,
153+
onClick = { selectedSection = "settings" }
154+
)
155+
}
156+
157+
Card(
158+
modifier = Modifier
159+
.fillMaxWidth()
160+
.padding(16.dp),
161+
shape = RoundedCornerShape(12.dp),
162+
backgroundColor = QPWTheme.colors.black,
163+
elevation = 0.dp
164+
) {
165+
Column(
166+
modifier = Modifier.padding(8.dp),
167+
verticalArrangement = Arrangement.spacedBy(6.dp)
168+
) {
169+
ContactButton(
170+
title = "Website",
171+
icon = Icons.Default.Language,
172+
color = QPWTheme.colors.red,
173+
onClick = {
174+
BrowserUtil.browse("https://candroid.dev")
175+
}
176+
)
177+
178+
ContactButton(
179+
title = "Plugin Page",
180+
icon = Icons.Default.Language,
181+
color = QPWTheme.colors.green,
182+
onClick = {
183+
BrowserUtil.browse("https://plugins.jetbrains.com/plugin/25221-quickprojectwizard/edit")
184+
}
185+
)
186+
187+
ContactButton(
188+
title = "Source Code",
189+
icon = Icons.Default.Source,
190+
color = QPWTheme.colors.purple,
191+
onClick = {
192+
BrowserUtil.browse("https://github.com/cnrture/QuickProjectWizard")
193+
},
194+
)
195+
}
196+
}
152197
}
153198
}
154199

@@ -206,4 +251,36 @@ class QuickProjectWizardToolWindowFactory : ToolWindowFactory {
206251
}
207252
}
208253
}
254+
255+
@Composable
256+
private fun ContactButton(
257+
title: String,
258+
icon: ImageVector,
259+
color: Color,
260+
onClick: () -> Unit,
261+
) {
262+
Row(
263+
modifier = Modifier
264+
.fillMaxWidth()
265+
.clickable { onClick() }
266+
.padding(horizontal = 8.dp, vertical = 4.dp),
267+
verticalAlignment = Alignment.CenterVertically,
268+
) {
269+
Icon(
270+
imageVector = icon,
271+
contentDescription = null,
272+
tint = color,
273+
modifier = Modifier.size(16.dp)
274+
)
275+
Spacer(modifier = Modifier.width(8.dp))
276+
QPWText(
277+
text = title,
278+
color = QPWTheme.colors.lightGray,
279+
style = TextStyle(
280+
fontSize = 12.sp,
281+
fontWeight = FontWeight.Medium
282+
)
283+
)
284+
}
285+
}
209286
}

0 commit comments

Comments
 (0)