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