chore: remove console log.

This commit is contained in:
Ivan Li 2023-01-15 15:30:20 +08:00
parent 5293ed52ff
commit 56f65fed10

View File

@ -14,7 +14,6 @@ import { update } from 'ramda';
const getPickerConfig = () => invoke<PickerConfiguration>('get_picker_config'); const getPickerConfig = () => invoke<PickerConfiguration>('get_picker_config');
const getScreenshotOfDisplays = () => const getScreenshotOfDisplays = () =>
invoke<ScreenshotDto[]>('take_snapshot').then((items) => { invoke<ScreenshotDto[]>('take_snapshot').then((items) => {
console.log(items);
return items; return items;
}); });
const getScreenshotByConfig = async (config: DisplayConfig) => { const getScreenshotByConfig = async (config: DisplayConfig) => {
@ -41,33 +40,23 @@ export const Configurator: FC = () => {
const { loading: pendingGetLedColorsByConfig, execute: onDisplayConfigChange } = const { loading: pendingGetLedColorsByConfig, execute: onDisplayConfigChange } =
useAsyncCallback(async (value: DisplayConfig) => { useAsyncCallback(async (value: DisplayConfig) => {
console.log('onDisplayConfigChange', value);
const screenshot = await getScreenshotByConfig(value); const screenshot = await getScreenshotByConfig(value);
setScreenshotOfDisplays((old) => { setScreenshotOfDisplays((old) => {
const index = old.findIndex((it) => it.config.id === screenshot.config.id); const index = old.findIndex((it) => it.config.id === screenshot.config.id);
const newValue = update(index, screenshot, old); const newValue = update(index, screenshot, old);
console.log({ old, n: newValue });
savedPickerConfig && savedPickerConfig &&
writePickerConfig({ writePickerConfig({
...savedPickerConfig, ...savedPickerConfig,
display_configs: newValue.map((it) => it.config), display_configs: newValue.map((it) => it.config),
}).then(() => {
console.log('writing config is successful.', {
...savedPickerConfig,
display_configs: newValue.map((it) => it.config),
});
}); });
return newValue; return newValue;
}); });
console.log('screenshot', screenshot);
}); });
const [displayConfigs, setDisplayConfigs] = useState<DisplayConfig[]>([]); const [displayConfigs, setDisplayConfigs] = useState<DisplayConfig[]>([]);
useEffect(() => { useEffect(() => {
const displayConfigs = savedPickerConfig?.display_configs; const displayConfigs = savedPickerConfig?.display_configs;
console.log('displayConfigs change', displayConfigs);
if (displayConfigs && defaultScreenshotOfDisplays) { if (displayConfigs && defaultScreenshotOfDisplays) {
setDisplayConfigs(displayConfigs); setDisplayConfigs(displayConfigs);
setScreenshotOfDisplays(defaultScreenshotOfDisplays); setScreenshotOfDisplays(defaultScreenshotOfDisplays);
@ -82,7 +71,6 @@ export const Configurator: FC = () => {
const displays = useMemo(() => { const displays = useMemo(() => {
if (screenshotOfDisplays) { if (screenshotOfDisplays) {
console.log({ c: screenshotOfDisplays });
return screenshotOfDisplays.map((screenshot, index) => ( return screenshotOfDisplays.map((screenshot, index) => (
<DisplayWithLedStrips <DisplayWithLedStrips
key={index} key={index}