Skip to content

Commit

Permalink
add connect button in context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Nov 15, 2023
1 parent d24f2d4 commit 9823db9
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/containers/ServerContextMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import Text from "../../components/Text";
import { images } from "../../constants/images";
import { useContextMenu } from "../../states/contextMenu";
import { usePersistentServers } from "../../states/servers";
import { useSettings } from "../../states/settings";
import { startGame } from "../../utils/helpers";
import { ThemeContext } from "./../../contexts/theme";

const ContextMenu = () => {
Expand All @@ -15,6 +17,11 @@ const ContextMenu = () => {
const { visible, position, server, hide } = useContextMenu();
const { addToFavorites, removeFromFavorites, favorites } =
usePersistentServers();
const { nickName, gtasaPath } = useSettings();

const [connectBtnBgCol, setConnectBtnBgCol] = useState(
theme.listHeaderBackgroundColor
);
const [favBtnBgCol, setFavBtnBgCol] = useState(
theme.listHeaderBackgroundColor
);
Expand Down Expand Up @@ -73,6 +80,42 @@ const ContextMenu = () => {
// alignItems: "center",
}}
>
<Pressable
onHoverIn={() =>
setConnectBtnBgCol(theme.selectedItemBackgroundColor)
}
onHoverOut={() =>
setConnectBtnBgCol(theme.listHeaderBackgroundColor)
}
onPress={() => {
startGame(
server,
nickName,
gtasaPath,
`${gtasaPath}/samp.dll`,
""
);
hide();
}}
style={{
backgroundColor: connectBtnBgCol,
paddingLeft: 10,
paddingRight: 30,
paddingVertical: 7,
flexDirection: "row",
alignItems: "center",
}}
>
<Icon
style={{ marginRight: 3 }}
image={images.icons.play}
color={theme.primary}
size={17}
/>
<Text bold color={"white"}>
{t("connect")}
</Text>
</Pressable>
<Pressable
onHoverIn={() => setFavBtnBgCol(theme.selectedItemBackgroundColor)}
onHoverOut={() => setFavBtnBgCol(theme.listHeaderBackgroundColor)}
Expand Down

0 comments on commit 9823db9

Please sign in to comment.