Skip to content
This repository was archived by the owner on Mar 25, 2026. It is now read-only.

feat: Separate Chat and Code tabs in SessionView#122

Open
TheRealAshik wants to merge 2 commits intomainfrom
feature/split-chat-code-tabs-17758077791937901816
Open

feat: Separate Chat and Code tabs in SessionView#122
TheRealAshik wants to merge 2 commits intomainfrom
feature/split-chat-code-tabs-17758077791937901816

Conversation

@TheRealAshik
Copy link
Copy Markdown
Owner

  • Added TabRow to SessionView for switching between Chat and Code modes.
  • Implemented CompactArtifactView to render non-expandable, simple summaries of bash and diff artifacts in Chat mode.
  • Filtered PR outputs, plan approvals, completion banners, and input errors to only show in the Chat tab.
  • Passed isCompactMode and showOnlyArtifacts flags to ActivityItem to conditionally render system events, conversational text, and full CodeBlocks depending on the selected tab index.

PR created automatically by Jules for task 17758077791937901816 started by @TheRealAshik

@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
julesagent Error Error Mar 23, 2026 11:48am

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the SessionView UI by introducing a tabbed navigation system. The primary goal is to improve the user experience by separating conversational elements from code-related artifacts. Users can now toggle between a 'Chat' tab, which focuses on dialogue and compact summaries, and a 'Code' tab, which is intended to display more detailed code information. This separation helps to declutter the interface and allows users to focus on the most relevant information for their current task.

Highlights

  • Tabbed Interface: Introduced a TabRow in SessionView to allow users to switch between 'Chat' and 'Code' modes, enhancing content organization.
  • Compact Artifact View: Implemented CompactArtifactView to provide concise summaries of bash and diff artifacts, specifically for display within the 'Chat' tab.
  • Conditional Content Rendering: Filtered various UI elements, including PR outputs, plan approvals, completion banners, and input errors, to be displayed exclusively in the 'Chat' tab.
  • Activity Item Refinement: Passed isCompactMode and showOnlyArtifacts flags to ActivityItem to enable conditional rendering of system events, conversational text, and full CodeBlock components based on the active tab.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully implements the separation of Chat and Code views using a TabRow, which is a great enhancement for user experience. The use of isCompactMode and showOnlyArtifacts flags to conditionally render content is a good approach. My review focuses on improving code maintainability and adherence to best practices. Specifically, I've suggested removing temporary Python scripts from the commit, replacing magic numbers with constants for better readability, refactoring ActivityItem to simplify its logic, and using theme colors instead of hardcoded values in CompactArtifactView.

Comment on lines +1053 to +1098
fun CompactArtifactView(title: String, subtitle: String? = null, isError: Boolean = false) {
val borderColor = if (isError) Color(0xFFEF4444).copy(alpha = 0.3f) else Color.White.copy(alpha = JulesOpacity.subtle)
val headerBg = if (isError) Color(0xFFEF4444).copy(alpha = JulesOpacity.subtle) else Color.White.copy(alpha = 0.02f)

Card(
colors = CardDefaults.cardColors(containerColor = Color(0xFF09090B)),
shape = JulesShapes.small,
modifier = Modifier.fillMaxWidth().border(1.dp, borderColor, JulesShapes.small)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.background(headerBg)
.padding(JulesSpacing.m),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
if (isError) Icons.Default.Warning else Icons.Default.Code,
null,
tint = if (isError) Color(0xFFF87171) else Color(0xFF71717A),
modifier = Modifier.size(16.dp)
)
Spacer(modifier = Modifier.width(JulesSpacing.s))
Column(modifier = Modifier.weight(1f)) {
Text(
title,
color = if (isError) Color(0xFFF87171) else Color(0xFFD4D4D8),
style = MaterialTheme.typography.bodySmall,
fontFamily = FontFamily.Monospace,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
if (subtitle != null) {
Text(
subtitle,
color = Color(0xFF71717A),
fontSize = 10.sp,
fontFamily = FontFamily.Monospace,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
}
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This composable uses several hardcoded hex color values (e.g., #EF4444, #09090B, #F87171, #71717A). This goes against best practices for theming in Compose. All colors should be sourced from MaterialTheme.colorScheme to ensure your UI adapts correctly to different themes and maintains consistency.

Please refactor this component to use theme colors. For example, Color(0xFFEF4444) should likely be MaterialTheme.colorScheme.error or a related color.

fun CompactArtifactView(title: String, subtitle: String? = null, isError: Boolean = false) {
    val borderColor = if (isError) MaterialTheme.colorScheme.error.copy(alpha = 0.3f) else MaterialTheme.colorScheme.outline.copy(alpha = JulesOpacity.subtle)
    val headerBg = if (isError) MaterialTheme.colorScheme.errorContainer else MaterialTheme.colorScheme.surfaceVariant

    Card(
        colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer),
        shape = JulesShapes.small,
        modifier = Modifier.fillMaxWidth().border(1.dp, borderColor, JulesShapes.small)
    ) {
        Row(
            modifier = Modifier
                .fillMaxWidth()
                .background(headerBg)
                .padding(JulesSpacing.m),
            verticalAlignment = Alignment.CenterVertically
        ) {
            Icon(
                if (isError) Icons.Default.Warning else Icons.Default.Code,
                null,
                tint = if (isError) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onSurfaceVariant,
                modifier = Modifier.size(16.dp)
            )
            Spacer(modifier = Modifier.width(JulesSpacing.s))
            Column(modifier = Modifier.weight(1f)) {
                 Text(
                     title,
                     color = if (isError) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onSurface,
                     style = MaterialTheme.typography.bodySmall,
                     fontFamily = FontFamily.Monospace,
                     maxLines = 1,
                     overflow = TextOverflow.Ellipsis
                 )
                 if (subtitle != null) {
                     Text(
                         subtitle,
                         color = MaterialTheme.colorScheme.onSurfaceVariant,
                         fontSize = 10.sp,
                         fontFamily = FontFamily.Monospace,
                         maxLines = 1,
                         overflow = TextOverflow.Ellipsis
                     )
                 }
            }
        }
    }
}

Comment on lines +141 to +157
TabRow(
selectedTabIndex = selectedTabIndex,
containerColor = MaterialTheme.colorScheme.surface,
contentColor = MaterialTheme.colorScheme.primary,
divider = { HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant) }
) {
Tab(
selected = selectedTabIndex == 0,
onClick = { selectedTabIndex = 0 },
text = { Text("Chat") }
)
Tab(
selected = selectedTabIndex == 1,
onClick = { selectedTabIndex = 1 },
text = { Text("Code") }
)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The TabRow implementation is a bit repetitive. You can make it more concise and scalable by using a loop. This also helps to move away from using magic numbers (0, 1) for tab indices by defining a list of tab titles.

I'd recommend defining val tabs = listOf("Chat", "Code") and then iterating over it to create the tabs.

            TabRow(
                selectedTabIndex = selectedTabIndex,
                containerColor = MaterialTheme.colorScheme.surface,
                contentColor = MaterialTheme.colorScheme.primary,
                divider = { HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant) }
            ) {
                listOf("Chat", "Code").forEachIndexed { index, title ->
                    Tab(
                        selected = selectedTabIndex == index,
                        onClick = { selectedTabIndex = index },
                        text = { Text(title) }
                    )
                }
            }


@Composable
fun ActivityItem(activity: JulesActivity, defaultCardState: Boolean, onApprovePlan: (String?) -> Unit) {
fun ActivityItem(activity: JulesActivity, defaultCardState: Boolean, onApprovePlan: (String?) -> Unit, isCompactMode: Boolean = false, showOnlyArtifacts: Boolean = false) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic within ActivityItem has become complex due to the introduction of the showOnlyArtifacts flag. The repeated if (!showOnlyArtifacts) checks make the code harder to follow.

Consider refactoring this composable to separate the rendering logic for the 'Chat' and 'Code' tabs more cleanly. You could use a top-level if-else on showOnlyArtifacts to handle the two different views. This would eliminate the need for repeated checks and improve readability.

For example:

@Composable
fun ActivityItem(...) {
    // ... common setup ...

    if (showOnlyArtifacts) {
        // Render for 'Code' tab (only artifacts)
        if (hasArtifacts) {
            Column(modifier = Modifier.padding(start = 40.dp)) {
                activity.artifacts.forEach { artifact ->
                    ArtifactView(artifact, defaultCardState, isCompactMode = false)
                    Spacer(modifier = Modifier.height(JulesSpacing.s))
                }
            }
        }
    } else {
        // Render for 'Chat' tab (full view with compact artifacts)
        // ... all the existing logic, but without the `!showOnlyArtifacts` checks
    }
}

Comment on lines +1 to +14
import re

file_path = "composeApp/src/commonMain/kotlin/dev/therealashik/client/jules/ui/screens/SessionView.kt"

with open(file_path, "r") as f:
content = f.read()

# Fix the double call issue in items
content = content.replace("ActivityItem(activity, defaultCardState, onApprovePlan)(isCompactMode = selectedTabIndex == 0, showOnlyArtifacts = selectedTabIndex == 1)",
"ActivityItem(activity, defaultCardState, onApprovePlan, isCompactMode = selectedTabIndex == 0, showOnlyArtifacts = selectedTabIndex == 1)")


with open(file_path, "w") as f:
f.write(content)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file, along with patch_activity_item.py, patch_artifact_view.py, patch_filter.py, patch_sessionview.py, and update_sessionview.py, appears to be a temporary script used for code generation. Such one-off scripts should not be committed to the repository's source tree. Please remove them to keep the codebase clean.

@TheRealAshik TheRealAshik marked this pull request as ready for review March 23, 2026 11:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant