hunk.code_window:     - name: Build
         if: ${{ inputs.target == 'x86_64-unknown-linux-gnu' }}
         uses: addnab/docker-run-action@v3
         with:
           image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
           options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build
           run: >-
             export CC=x86_64-unknown-linux-gnu-gcc &&
             export CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc &&
             yarn nx build @affine/native --target ${{ inputs.target }} &&
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep
hunk.after_edit:         options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build -e NX_CLOUD_ACCESS_TOKEN=${{ inputs.nx_token }}
  
hunk.file_path: .github/actions/build-rust/action.yml
hunk.type: replace
file: import { Button } from '@affine/component';
  import { styled } from '@affine/component';
  import { useAFFiNEI18N } from '@affine/i18n/hooks';
  import type { ChangeEvent } from 'react';
  import type React from 'react';
  import { useRef } from 'react';
  
  export type UploadProps = React.PropsWithChildren<{
    uploadType?: string;
    accept?: string;
    fileChange: (file: File) => void;
  }>;
  
  export const Upload: React.FC<UploadProps> = ({
    fileChange,
    accept,
    children,
    ...props
  }) => {
    const t = useAFFiNEI18N();
    const input_ref = useRef<HTMLInputElement>(null);
    const _chooseFile = () => {
      if (input_ref.current) {
        input_ref.current.click();
      }
    };
    const _handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
      const files = e.target.files;
      if (!files) {
        return;
      }
      const file = files[0];
      fileChange(file);
      if (input_ref.current) {
        input_ref.current.value = '';
      }
    };
    return (
      <UploadStyle onClick={_chooseFile}>
        {children ?? <Button>{t['Upload']()}</Button>}
        <input
          ref={input_ref}
          type="file"
          style={{ display: 'none' }}
          onChange={_handleInputChange}
          accept={accept}
          {...props}
        />
      </UploadStyle>
    );
  };
  
  const UploadStyle = styled('div')(() => {
    return {
      display: 'inline-block',
    };
  });
  