-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
a79dcca
commit 8fe492a
Showing
42 changed files
with
295 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Flexispot Menubar | ||
|
||
This project contains an ESPHome configuration file that will connect a ESP32 to the Flexispot table and a simple menubar app to interact with the table. | ||
|
||
![Demo image](/menubar/demo/demo.png) |
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 was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 +1,14 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<html lang="en" class="h-full"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Tauri + React + TS</title> | ||
<title>Flexispot Menubar</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
<body class="h-full"> | ||
<div id="root" class="h-full"></div> | ||
<script type="module" src="/src/windows/menubar/index.tsx"></script> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 was deleted.
Oops, something went wrong.
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,38 @@ | ||
import { FetchOptions, fetch } from '@tauri-apps/api/http'; | ||
|
||
export enum Preset { | ||
One = 'preset_1', | ||
Two = 'preset_2', | ||
Stand = 'stand', | ||
Sit = 'sit', | ||
} | ||
|
||
interface SensorResponse { | ||
id: string; | ||
value: number; | ||
state: string; | ||
} | ||
|
||
export class Flexispot { | ||
constructor(private baseUrl: string) {} | ||
|
||
triggerPreset(preset: Preset) { | ||
return this.fetch<void>(`/switch/${preset}/turn_on`, { method: 'POST' }); | ||
} | ||
|
||
async getUptime(): Promise<SensorResponse> { | ||
const response = await this.fetch<SensorResponse>(`/sensor/uptime`, { method: 'GET' }); | ||
|
||
return response.data; | ||
} | ||
|
||
async getWifiSignal(): Promise<SensorResponse> { | ||
const response = await this.fetch<SensorResponse>(`/sensor/wifi_signal`); | ||
|
||
return response.data; | ||
} | ||
|
||
private fetch<T>(path: string, options?: FetchOptions) { | ||
return fetch<T>(`${this.baseUrl}${path}`, options); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
import classNames from 'classNames'; | ||
|
||
interface MenuItemProps extends React.ComponentPropsWithoutRef<'button'> { | ||
children: React.ReactNode; | ||
hasError?: boolean; | ||
icon: React.ReactNode; | ||
isDisabled?: boolean; | ||
isLoading?: boolean; | ||
} | ||
|
||
export const MenuItem = ({ children, hasError, icon, isDisabled, isLoading, ...props }: MenuItemProps) => { | ||
return ( | ||
<button | ||
className={classNames( | ||
'flex flex-col items-center rounded-lg p-3 cursor-pointer transition-all text-gray-700 fill-gray-700', | ||
{ | ||
'hover:text-sky-500 hover:fill-sky-500 hover:bg-sky-100': !isDisabled, | ||
'text-gray-300 fill-gray-300': isDisabled, | ||
'animate-pulse': isLoading, | ||
'animate-error': hasError, | ||
}, | ||
)} | ||
{...props} | ||
> | ||
<div>{icon}</div> | ||
|
||
<p className='font-light text-sm tracking-wide pt-1'>{children}</p> | ||
</button> | ||
); | ||
}; |
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,15 @@ | ||
import { IconProps } from './types'; | ||
|
||
export const OneIcon = (props: IconProps) => { | ||
return ( | ||
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' {...props}> | ||
<path d='M11.98 17h1.976V7.033h-.212L9.622 8.51v1.606l2.358-.731V17Z' /> | ||
|
||
<path | ||
fillRule='evenodd' | ||
clipRule='evenodd' | ||
d='M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z' | ||
/> | ||
</svg> | ||
); | ||
}; |
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,11 @@ | ||
import { IconProps } from './types'; | ||
|
||
export const SeatIcon = (props: IconProps) => { | ||
return ( | ||
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' {...props}> | ||
<path d='M356.875 103.922c27.761-10.39 41.815-41.317 31.363-69.109C377.849 7.082 346.901-6.971 319.17 3.429c-27.751 10.42-41.785 41.347-31.394 69.108 10.41 27.762 41.358 41.826 69.099 31.385zm38.894 207.214V167.261c-.367-21.798-18.358-39.159-40.156-38.772-21.808.376-39.201 18.328-38.824 40.136v129.761l-85.29 15.57c-18.236 3.094-32.911 15.845-33.002 35.232l2.595 129.984c-.05 15.142 12.192 27.517 27.386 27.6 15.173.02 27.538-12.212 27.598-27.395l7.988-102.05h73.475c41.256-.105 58.352-24.955 58.23-66.191z' /> | ||
|
||
<path d='M461.529 233.388c-11.245-2.412-22.306 4.792-24.698 16.058l-22.204 104.605c-1.71 7.367-3.918 13.199-6.402 17.758-3.837 6.818-7.918 10.888-14.054 14.38-6.117 3.398-14.888 5.984-27.284 6.95-3.277.274-6.778.468-10.523.498h-58.758c-11.52.183-20.668 9.739-20.476 21.249.194 11.51 9.688 20.668 21.208 20.485h58.453c4.601-.041 9.078-.336 13.403-.662 10.98-.895 21.136-2.778 30.601-6.054 14.166-4.844 26.683-13.22 35.842-24.658 9.24-11.388 15.01-25.167 18.592-40.493l.062-.244 22.306-105.174c2.393-11.266-4.802-22.338-16.068-24.698zm-252.173-7.653v-29.838H101.505L61.674 95.679 33.943 106.69l47.321 119.045zm41.683 14.634H35.673V512h38.213V282.011h177.153z' /> | ||
</svg> | ||
); | ||
}; |
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,9 @@ | ||
import { IconProps } from './types'; | ||
|
||
export const StandIcon = (props: IconProps) => { | ||
return ( | ||
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' {...props}> | ||
<path d='M370.875 103.922c27.761-10.39 41.815-41.317 31.363-69.109C391.849 7.082 360.901-6.971 333.17 3.429c-27.751 10.42-41.785 41.347-31.394 69.108 10.41 27.762 41.358 41.826 69.099 31.385Zm24.894 207.214V167.261c-.367-21.798-18.358-39.159-40.156-38.772-21.808.376-39.201 18.328-38.824 40.136v129.761l12.303 180.786c-.05 15.142 12.192 27.517 27.386 27.6 15.173.02 27.538-12.212 27.598-27.395 0 0 11.815-127.005 11.693-168.241ZM209.356 183.735v-31.838H101.505L61.674 51.679 33.943 62.69l47.321 121.045h128.092Zm41.683 14.634H35.673V512h38.213V240.011h177.153v-41.642Z' /> | ||
</svg> | ||
); | ||
}; |
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,15 @@ | ||
import { IconProps } from './types'; | ||
|
||
export const TwoIcon = (props: IconProps) => { | ||
return ( | ||
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' {...props}> | ||
<path d='M9.157 17h6.822v-1.593H11.7l2.263-2.386c.62-.679 1.057-1.273 1.312-1.784.256-.51.383-1.011.383-1.504 0-.897-.285-1.592-.854-2.085-.565-.492-1.36-.738-2.386-.738-.67 0-1.27.144-1.798.43a3.06 3.06 0 0 0-1.23 1.177 3.283 3.283 0 0 0-.431 1.66h1.982c0-.5.128-.904.383-1.21.26-.31.613-.464 1.06-.464.415 0 .733.128.957.383.223.25.335.597.335 1.039 0 .323-.107.665-.322 1.025-.21.36-.535.782-.977 1.265l-3.22 3.431V17Z' /> | ||
|
||
<path | ||
fillRule='evenodd' | ||
clipRule='evenodd' | ||
d='M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z' | ||
/> | ||
</svg> | ||
); | ||
}; |
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,5 @@ | ||
export interface IconProps { | ||
width?: number; | ||
height?: number; | ||
className?: string; | ||
} |
Oops, something went wrong.