generated from mistricky/nvim-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,764 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
local path_utils = require("codesnap.utils.path") | ||
|
||
return { | ||
config = { | ||
breadcrumbs = true, | ||
column_number = true, | ||
mac_window_bar = true, | ||
opacity = true, | ||
watermark = "CodeSnap.nvim", | ||
auto_load = true, | ||
}, | ||
cwd = path_utils.back(path_utils.back(debug.getinfo(1, "S").source:sub(2):match("(.*[/\\])"))), | ||
preview_switch = true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
local codesnap = require("codesnap") | ||
local snap_client_cwd = codesnap.cwd .. "/snap-client" | ||
local snap_server_cwd = codesnap.cwd .. "/snap-server" | ||
|
||
-- Build preview client | ||
os.execute( | ||
"cd " | ||
.. snap_client_cwd | ||
.. " && " | ||
.. "npm i " | ||
.. " && " | ||
.. "npm run build" | ||
.. " && " | ||
.. "mv ./build " | ||
.. snap_server_cwd | ||
.. "/public" | ||
) | ||
|
||
-- Build server | ||
os.execute("cd " .. snap_server_cwd .. " && " .. "cargo build --release") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
snap-client/src/components/control-bar/connection-status.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useMemo } from "react"; | ||
import { ReadyState } from "react-use-websocket"; | ||
|
||
interface ConnectionStatusProps { | ||
readyState: ReadyState; | ||
} | ||
|
||
const CONNECTION_STATUS_MAP = { | ||
[ReadyState.CONNECTING]: { | ||
text: "Connecting", | ||
color: "#fdcb6e", | ||
}, | ||
[ReadyState.OPEN]: { | ||
text: "Connected", | ||
color: "#00b894", | ||
}, | ||
[ReadyState.CLOSING]: { | ||
text: "Closing", | ||
color: "#fab1a0", | ||
}, | ||
[ReadyState.CLOSED]: { | ||
text: "Closed", | ||
color: "#636e72", | ||
}, | ||
[ReadyState.UNINSTANTIATED]: { | ||
text: "Uninstantiated", | ||
color: "#2d3436", | ||
}, | ||
} as const; | ||
|
||
const UNKNOWN_STATE = { text: "Unknown", color: "#a29bfe" }; | ||
|
||
export const ConnectionStatus = ({ readyState }: ConnectionStatusProps) => { | ||
const parsedState = useMemo( | ||
() => CONNECTION_STATUS_MAP[readyState] ?? UNKNOWN_STATE, | ||
[readyState], | ||
); | ||
|
||
return ( | ||
<div className="flex flex-grow flex-row items-center mr-1 ml-2"> | ||
<div | ||
className="flex w-5 h-5 mr-2 justify-center items-center rounded-full" | ||
style={{ backgroundColor: `${parsedState.color}50` }} | ||
> | ||
<div | ||
className="w-3 h-3 rounded-full" | ||
style={{ backgroundColor: parsedState.color }} | ||
></div> | ||
</div> | ||
{parsedState.text} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.