Sheets settings (#774)

* wip: migrate sheet settings

---------

Co-authored-by: arc-alex <ac@omnivox.dk>
This commit is contained in:
Carlos Valente
2024-02-17 22:05:38 +01:00
committed by GitHub
parent c1377544a0
commit 5a397c6da7
34 changed files with 732 additions and 701 deletions
+10 -9
View File
@@ -275,7 +275,8 @@ export const uploadSheetClientFile = async (file: File) => {
/**
* @description STEP 1 test
*/
export const getClientSecrect = async () => {
// TODO: do we still need this?
export const getClientSecret = async () => {
const response = await axios.get(`${ontimeURL}/sheet/clientsecret`);
return response.data;
};
@@ -300,32 +301,32 @@ export const getAuthentication = async () => {
* @description STEP 3
* @returns worksheetOptions
*/
export const postId = async (id: string) => {
const response = await axios.post(`${ontimeURL}/sheet/id`, { id });
export const postId = async (sheetId: string) => {
const response = await axios.post(`${ontimeURL}/sheet/sheetId`, { sheetId });
return response.data;
};
/**
* @description STEP 4
*/
export const postWorksheet = async (id: string, worksheet: string) => {
const response = await axios.post(`${ontimeURL}/sheet/worksheet`, { id, worksheet });
export const postWorksheet = async (sheetId: string, worksheet: string) => {
const response = await axios.post(`${ontimeURL}/sheet/worksheet`, { sheetId, worksheet });
return response.data;
};
/**
* @description STEP 5
*/
export const postPreviewSheet = async (id: string, options: ExcelImportMap) => {
const response = await axios.post(`${ontimeURL}/sheet/pull`, { id, options });
export const postPreviewSheet = async (sheetId: string, options: ExcelImportMap) => {
const response = await axios.post(`${ontimeURL}/sheet-pull`, { sheetId, options });
return response.data.data;
};
/**
* @description STEP 5
*/
export const postPushSheet = async (id: string, options: ExcelImportMap) => {
const response = await axios.post(`${ontimeURL}/sheet-push`, { id, options });
export const postPushSheet = async (sheetId: string, options: ExcelImportMap) => {
const response = await axios.post(`${ontimeURL}/sheet-push`, { sheetId, options });
return response.data.data;
};
@@ -68,7 +68,7 @@ export const ContextMenu = ({ children }: ContextMenuProps) => {
<>
{children}
<div className={style.contextMenuBackdrop} />
<Menu isOpen gutter={0} onClose={onClose} isLazy lazyBehavior='unmount' variant='ontime-on-dark'>
<Menu isOpen size='sm' gutter={0} onClose={onClose} isLazy lazyBehavior='unmount' variant='ontime-on-dark'>
<MenuButton
className={style.contextMenuButton}
aria-hidden
@@ -6,6 +6,7 @@
color: $blue-500;
transition-property: color;
transition-duration: $transition-time-action;
width: fit-content;
&.inline {
display: inline-flex;
@@ -1,7 +1,6 @@
import { PropsWithChildren } from 'react';
import { InputGroup, Tooltip } from '@chakra-ui/react';
import { InputGroup } from '@chakra-ui/react';
import { tooltipDelayFast } from '../../../../ontimeConfig';
import { cx } from '../../../utils/styleUtils';
import TimeInput from './TimeInput';
@@ -24,16 +23,14 @@ export default function TimeInputWithButton<T extends string>(props: PropsWithCh
return (
<InputGroup size='sm' className={inputClasses} width='fit-content'>
<Tooltip label={placeholder} openDelay={tooltipDelayFast} variant='ontime-ondark'>
<TimeInput<T>
name={name}
submitHandler={submitHandler}
time={time}
placeholder={placeholder}
className={style.inputField}
disabled={disabled}
/>
</Tooltip>
<TimeInput<T>
name={name}
submitHandler={submitHandler}
time={time}
placeholder={placeholder}
className={style.inputField}
disabled={disabled}
/>
{children}
</InputGroup>
);