update hamburger item label

pull/4550/head
yann300 9 months ago
parent d9027bd0ec
commit c94b2de42e
  1. 3
      apps/remix-ide/src/app/tabs/locales/en/filePanel.json
  2. 6
      libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx
  3. 12
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  4. 9
      libs/remix-ui/workspace/src/lib/types/index.ts

@ -66,7 +66,8 @@
"filePanel.workspace.publishToGist": "Publish workspace to GitHub gist",
"filePanel.uploadFile": "Upload files",
"filePanel.uploadFolder": "Upload folder",
"filePanel.updateGist": "Publish workspace to GitHub gist",
"filePanel.updateGist": "Update Gist",
"filePanel.workspace.updateGist": "Publish Gist update",
"filePanel.viewAllBranches": "View all branches",
"filePanel.createBranch": "Create branch",
"filePanel.switchBranches": "Switch branches",

@ -2,8 +2,10 @@ import { appPlatformTypes } from '@remix-ui/app'
import React from 'react'
import {Dropdown} from 'react-bootstrap'
import {HamburgerMenuItem, HamburgerSubMenuItem} from './workspace-hamburger-item'
import { WorkspaceMetadata } from '../types'
export interface HamburgerMenuProps {
selectedWorkspace: WorkspaceMetadata
createWorkspace: () => void
renameCurrentWorkspace: () => void
downloadCurrentWorkspace: () => void
@ -25,7 +27,7 @@ export interface HamburgerMenuProps {
}
export function HamburgerMenu(props: HamburgerMenuProps) {
const {showIconsMenu, hideWorkspaceOptions, hideLocalhostOptions, hideFileOperations} = props
const {showIconsMenu, hideWorkspaceOptions, hideLocalhostOptions, hideFileOperations, selectedWorkspace} = props
return (
<>
<HamburgerMenuItem
@ -90,7 +92,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
></HamburgerMenuItem>
<Dropdown.Divider className="border mb-0 mt-0 remixui_menuhr" style={{pointerEvents: 'none'}} />
<HamburgerMenuItem
kind="publishToGist"
kind={selectedWorkspace.isGist ? "updateGist" : "publishToGist"}
fa="fab fa-github"
hideOption={hideWorkspaceOptions || hideLocalhostOptions}
actionOnClick={() => {

@ -9,7 +9,7 @@ import './css/remix-ui-workspace.css'
import {ROOT_PATH, TEMPLATE_NAMES} from './utils/constants'
import {HamburgerMenu} from './components/workspace-hamburger'
import {MenuItems, WorkSpaceState} from './types'
import {MenuItems, WorkSpaceState, WorkspaceMetadata} from './types'
import {contextMenuActions} from './utils'
import FileExplorerContextMenu from './components/file-explorer-context-menu'
import { customAction } from '@remixproject/plugin-api'
@ -27,14 +27,7 @@ export function Workspace() {
const LOCALHOST = ' - connect to localhost - '
const NO_WORKSPACE = ' - none - '
const [currentWorkspace, setCurrentWorkspace] = useState<string>(NO_WORKSPACE)
const [selectedWorkspace, setSelectedWorkspace] = useState<{
name: string
isGitRepo: boolean
hasGitSubmodules?: boolean
branches?: {remote: any; name: string}[]
currentBranch?: string
isGist: string
}>(null)
const [selectedWorkspace, setSelectedWorkspace] = useState<WorkspaceMetadata>(null)
const [showDropdown, setShowDropdown] = useState<boolean>(false)
const [showIconsMenu, hideIconsMenu] = useState<boolean>(false)
const [showBranches, setShowBranches] = useState<boolean>(false)
@ -952,6 +945,7 @@ export function Workspace() {
></Dropdown.Toggle>
<Dropdown.Menu as={CustomMenu} data-id="wsdropdownMenu" className="custom-dropdown-items remixui_menuwidth" rootCloseEvent="click">
<HamburgerMenu
selectedWorkspace={selectedWorkspace}
createWorkspace={createWorkspace}
renameCurrentWorkspace={renameCurrentWorkspace}
downloadCurrentWorkspace={downloadCurrentWorkspace}

@ -47,6 +47,15 @@ export interface FileType {
child?: File[]
}
export type WorkspaceMetadata = {
name: string
isGitRepo: boolean
hasGitSubmodules?: boolean
branches?: {remote: any; name: string}[]
currentBranch?: string
isGist: string
}
export interface FilePanelType extends ViewPlugin {
setWorkspace: ({ name, isLocalhost }, setEvent: boolean) => void
createWorkspace: (name: string, workspaceTemplateName: string) => void

Loading…
Cancel
Save