diff --git a/shared/common/styles.scss b/shared/common/styles.scss index 4c2514a3..122682f8 100644 --- a/shared/common/styles.scss +++ b/shared/common/styles.scss @@ -3,7 +3,11 @@ :root { --baseTextLightTheme: #1a1a1a; --baseTextDarkTheme: #b9b9b9; - --accentPurple: #b199f2; + + --accentGreenLightTheme: #2cb88e; + --accentGreenDarkTheme: #279474; + + --accentPurpleLightTheme: #b199f2; --grey8: #141414; --grey12: #1f1f1f; diff --git a/shared/common/ui/closeButton/closeButton.module.scss b/shared/common/ui/closeButton/closeButton.module.scss deleted file mode 100644 index ce829ebe..00000000 --- a/shared/common/ui/closeButton/closeButton.module.scss +++ /dev/null @@ -1,20 +0,0 @@ -@import "../../mixins.scss"; - -.container { - width: 48px; - height: 48px; - border: none; - border-radius: 50%; - color: #f9f9f9; - background-color: var(--accentPurple); - filter: drop-shadow(0px 0px 8px rgba(0, 0, 0, 0.2)); - display: flex; - align-items: center; - justify-content: center; - - @include darkTheme { - color: var(--grey8); - background-color: var(--grey60); - filter: drop-shadow(0px 0px 8px rgba(0, 0, 0, 0.2)); - } -} diff --git a/shared/common/ui/closeButton/index.tsx b/shared/common/ui/closeButton/index.tsx deleted file mode 100644 index 7e90f570..00000000 --- a/shared/common/ui/closeButton/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import cn from "@edgedb/common/utils/classNames"; -import {CrossIcon} from "../icons"; -import styles from "./closeButton.module.scss"; - -interface CloseButtonProps { - onClick: () => void; - className?: string; -} - -const CloseButton = ({onClick, className}: CloseButtonProps) => ( - - - -); - -export default CloseButton; diff --git a/shared/common/ui/icons/index.tsx b/shared/common/ui/icons/index.tsx index ad75d9c6..61eb372c 100644 --- a/shared/common/ui/icons/index.tsx +++ b/shared/common/ui/icons/index.tsx @@ -84,6 +84,23 @@ export const CrossIcon = () => ( ); +export const RunIcon = () => ( + + + +); + export const SearchIcon = () => ( void; + className?: string; +} + +export const CloseButton = ({onClick, className}: CloseButtonProps) => ( + + + +); + +interface RunButtonProps { + onClick: () => void; + className?: string; + disabled?: boolean; + isLoading?: boolean; +} + +export const RunButton = ({ + onClick, + className, + disabled = false, + isLoading = false, +}: RunButtonProps) => ( + + {isLoading ? : } + +); diff --git a/shared/common/ui/mobileButtons/mobileButtons.module.scss b/shared/common/ui/mobileButtons/mobileButtons.module.scss new file mode 100644 index 00000000..f2361f43 --- /dev/null +++ b/shared/common/ui/mobileButtons/mobileButtons.module.scss @@ -0,0 +1,40 @@ +@import "../../mixins.scss"; + +.container { + border: none; + border-radius: 50%; + color: #f9f9f9; + filter: drop-shadow(0px 0px 8px rgba(0, 0, 0, 0.2)); + display: flex; + align-items: center; + justify-content: center; + + &.run { + height: 40px; + width: 40px; + background-color: var(--accentGreenLightTheme); + + &:disabled { + opacity: 0.5; + } + } + + &.close { + width: 48px; + height: 48px; + background-color: var(--accentPurpleLightTheme); + } + + @include darkTheme { + filter: drop-shadow(0px 0px 8px rgba(0, 0, 0, 0.2)); + color: var(--grey8); + + &.close { + background-color: var(--grey60); + } + + &.run { + background-color: var(--accentGreenDarkTheme); + } + } +} diff --git a/shared/common/ui/navtabs/mobile.tsx b/shared/common/ui/navtabs/mobile.tsx index 84e94210..667b9002 100644 --- a/shared/common/ui/navtabs/mobile.tsx +++ b/shared/common/ui/navtabs/mobile.tsx @@ -4,7 +4,7 @@ import cn from "../../utils/classNames"; import {useModal} from "../../hooks/useModal"; import {BaseTabBarProps} from "./interfaces"; import {ThemeSwitcher} from "../themeSwitcher"; -import CloseButton from "../closeButton"; +import {CloseButton} from "../mobileButtons"; import styles from "./mobileNavTabs.module.scss"; export interface MobileNavTabsProps extends BaseTabBarProps { diff --git a/shared/common/ui/themeSwitcher/themeSwitcher.module.scss b/shared/common/ui/themeSwitcher/themeSwitcher.module.scss index 57cb236f..d3f85c9d 100644 --- a/shared/common/ui/themeSwitcher/themeSwitcher.module.scss +++ b/shared/common/ui/themeSwitcher/themeSwitcher.module.scss @@ -50,6 +50,10 @@ svg { opacity: 1; } + + @include breakpoint(mobile) { + color: var(--baseText); + } } @include breakpoint(mobile) { @@ -59,11 +63,6 @@ &.active { color: #74a6fc; - // background-color: var(--grey95); - - @include darkTheme { - // background-color: #242424; - } @include breakpoint(mobile) { background-color: #fff; diff --git a/shared/studio/tabs/dashboard/databaseDashboard.module.scss b/shared/studio/tabs/dashboard/databaseDashboard.module.scss index 35553840..2ef0d2b1 100644 --- a/shared/studio/tabs/dashboard/databaseDashboard.module.scss +++ b/shared/studio/tabs/dashboard/databaseDashboard.module.scss @@ -173,6 +173,7 @@ background: linear-gradient(90.06deg, #a088ff 1.59%, #e48da2 102.98%); background-clip: text; + -webkit-background-clip: text; -webkit-text-fill-color: transparent; } diff --git a/shared/studio/tabs/queryEditor/index.tsx b/shared/studio/tabs/queryEditor/index.tsx index bc9a0f6c..7d5ddc46 100644 --- a/shared/studio/tabs/queryEditor/index.tsx +++ b/shared/studio/tabs/queryEditor/index.tsx @@ -5,6 +5,7 @@ import {Text} from "@codemirror/state"; import cn from "@edgedb/common/utils/classNames"; import {CodeEditor, CodeEditorRef} from "@edgedb/code-editor"; +import {RunButton} from "@edgedb/common/ui/mobileButtons"; import styles from "./repl.module.scss"; @@ -26,7 +27,7 @@ import {CustomScrollbars} from "@edgedb/common/ui/customScrollbar"; import {HistoryPanel} from "./history"; import ParamEditorPanel from "./paramEditor"; -import {TabEditorIcon, MobileHistoryIcon, MobileRunIcon} from "../../icons"; +import {TabEditorIcon, MobileHistoryIcon} from "../../icons"; import {useResize} from "@edgedb/common/hooks/useResize"; import {VisualQuerybuilder} from "../../components/visualQuerybuilder"; import Inspector from "@edgedb/inspector"; @@ -172,21 +173,13 @@ export const QueryEditorView = observer(function QueryEditorView() { ) } /> - editorState.runQuery()} + isLoading={editorState.queryRunning} disabled={ !editorState.canRunQuery || !!splitViewState.activeViewIndex } - > - {editorState.queryRunning ? ( - - ) : ( - - )} - + /> {editorState.showHistory && ( diff --git a/shared/studio/tabs/repl/index.tsx b/shared/studio/tabs/repl/index.tsx index 497ae4b8..50226ed1 100644 --- a/shared/studio/tabs/repl/index.tsx +++ b/shared/studio/tabs/repl/index.tsx @@ -56,6 +56,7 @@ import {useDBRouter} from "../../hooks/dbRoute"; import styles from "./repl.module.scss"; import {isEndOfStatement} from "./state/utils"; import {useIsMobile} from "@edgedb/common/hooks/useMobile"; +import {RunButton} from "@edgedb/common/ui/mobileButtons"; const ReplView = observer(function ReplView() { const replState = useTabState(Repl); @@ -229,6 +230,12 @@ const ReplList = observer(function ReplList({ + replState.runQuery()} + isLoading={replState.queryRunning} + disabled={!replState.canRunQuery} + className={styles.runBtn} + /> ); }); @@ -476,9 +483,13 @@ const ReplHistoryItem = observer(function ReplHistoryItem({ output = renderCommandResult(item.commandResult.data); } else { output = ( - - - + <> + {!isMobile ? ( + + + + ) : null} + > ); } diff --git a/shared/studio/tabs/repl/repl.module.scss b/shared/studio/tabs/repl/repl.module.scss index b9759d3a..b54e5b4e 100644 --- a/shared/studio/tabs/repl/repl.module.scss +++ b/shared/studio/tabs/repl/repl.module.scss @@ -116,6 +116,17 @@ overflow: auto; @include hideScrollbar; + + .runBtn { + display: none; + + @include breakpoint(mobile) { + display: flex; + position: absolute; + bottom: 8px; + right: 16px; + } + } } .scrollInner { diff --git a/shared/studio/tabs/repl/state/index.ts b/shared/studio/tabs/repl/state/index.ts index 5ac8764f..5e1ca02e 100644 --- a/shared/studio/tabs/repl/state/index.ts +++ b/shared/studio/tabs/repl/state/index.ts @@ -1,4 +1,4 @@ -import {action, observable} from "mobx"; +import {action, observable, computed} from "mobx"; import { Frozen, frozen, @@ -310,6 +310,11 @@ export class Repl extends Model({ @observable queryRunning = false; + @computed + get canRunQuery() { + return !this.queryRunning && !!this.currentQuery.toString().trim(); + } + @modelFlow runQuery = _async(function* (this: Repl, queryStr?: string) { const dbState = dbCtx.get(this)!;