Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract attachments into new components #330

Closed
wants to merge 65 commits into from

Commits on May 15, 2023

  1. initial commit

    susanm74 committed May 15, 2023
    Configuration menu
    Copy the full SHA
    7faed7b View commit details
    Browse the repository at this point in the history
  2. - created AttachmentsList and AttachmentsUploader and updated Attachm…

    …ents to use list and uploader components inside of the AttachmentsDropZone slot
    susanm74 committed May 15, 2023
    Configuration menu
    Copy the full SHA
    32886dd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    30391a2 View commit details
    Browse the repository at this point in the history
  4. - test

    susanm74 committed May 15, 2023
    Configuration menu
    Copy the full SHA
    ec0496e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    694b67a View commit details
    Browse the repository at this point in the history
  6. - removed unused import in Attachments

    - removed unused styled in AttachmentsList
    susanm74 committed May 15, 2023
    Configuration menu
    Copy the full SHA
    5422a15 View commit details
    Browse the repository at this point in the history

Commits on May 16, 2023

  1. Configuration menu
    Copy the full SHA
    dea50e4 View commit details
    Browse the repository at this point in the history
  2. - removed unused inner components class

    - added missing closing quotes to drag-dropped and content-changed event handlers
    susanm74 committed May 16, 2023
    Configuration menu
    Copy the full SHA
    b59ea88 View commit details
    Browse the repository at this point in the history
  3. - added lots of console logs

    - working, but with what feels like more re-renders than necessary, and so wondering if we can cut down on those
    - also wondering if AttachmentsList should be it's own separate component or just implemented as part of whatever component is using the AttachmentsDropZone and AttachmentsUploader components
    susanm74 committed May 16, 2023
    Configuration menu
    Copy the full SHA
    4720541 View commit details
    Browse the repository at this point in the history
  4. - removed extra custom event fire from Attachments updated

    - updated handleAttachmentsAdded to do one requestUpdate for attachmentsList instead of two separate updates (one for currentAttachments, one for failedAttachments)
    - added requestUpdate for attachmentsUploader in handleAttachmentsRemoved
    susanm74 committed May 16, 2023
    Configuration menu
    Copy the full SHA
    15196ea View commit details
    Browse the repository at this point in the history
  5. - removed unused import

    susanm74 committed May 16, 2023
    Configuration menu
    Copy the full SHA
    a6b8e50 View commit details
    Browse the repository at this point in the history
  6. - removed extra console logs

    susanm74 committed May 16, 2023
    Configuration menu
    Copy the full SHA
    19e8688 View commit details
    Browse the repository at this point in the history
  7. - removed upload_endpoint from Attachments

    - moved attachment interface from Attachments to AttachmentUploader
    - removed attribute: false from failedAttachments properties across all 3 components
    susanm74 committed May 16, 2023
    Configuration menu
    Copy the full SHA
    42bb4ca View commit details
    Browse the repository at this point in the history

Commits on May 18, 2023

  1. - created temba-image-picker

    - added two image-pickers to demo page, one for avatars, one for logos
    - added vector icons for avatars and logos
    - added removeIcon property for configuring remove icon
    - added uploadIcon property for configuring upload icon
    - added default upload_icon and max_attachments to AttachmentsUploader
    - reworked uploadFiles to check for when maxAttachments is 1
    - reworked uploadFiles to check whether the total of currentAttachments and filesToUpload exceeds maxAttachments and to adjust the filesToUpload to only allow up to maxAttachments (assuming all of the filesToUpload will be successful)
    - updated addCurrentAttachment and addFailedAttachment to check for maxAttachments
    - updated render to check for maxAttachments and render the input as single vs multiple when 1 vs 1+
    susanm74 committed May 18, 2023
    Configuration menu
    Copy the full SHA
    237b9de View commit details
    Browse the repository at this point in the history

Commits on May 19, 2023

  1. - added example divs to attachments tab for spacing in between demo c…

    …omponents
    
    - updated AttachmentsDropZone slot to remove name attribute
    - added maxAttachments attribute to AttachmentsPicker, and now setting maxAttachments in AttachmentsPicker and ImagePicker (instead of AttachmentsUploader)
    - fixed AttachmentsUploader single vs multiple input bug by creating render helper getInput()
    - reduced of ImagePicker img width and height to match closer to product
    - added actions-left styling to ImagePicker
    - added "remove image" to ImagePicker getActions() - need to finalize where to place the "remove image" - top right corner vs. on same horizontal plane as "upload image" vs somewhere else
    - created a draft Compose2 to start reworking the new attachments components into compose
    - removed attachment_avatar and attachment_logo from vector icons enum in favor of using attachment and attachment_image for now
    susanm74 committed May 19, 2023
    Configuration menu
    Copy the full SHA
    15c47f3 View commit details
    Browse the repository at this point in the history

Commits on May 22, 2023

  1. - added custom width for attachments drop zone container

    - moved remove icon to inside of div.image-item so as to allow for overlapping of the remove icon in the bottom right corner of the img
    - switched from div.actions-left, div.actions-center, and div.actions-right to just div.action-item
    susanm74 committed May 22, 2023
    Configuration menu
    Copy the full SHA
    3f12704 View commit details
    Browse the repository at this point in the history
  2. - replace Compose2 with AttachmentsDropZone, AttachmentsList, and Att…

    …achmentsUploader inner components
    
    - added custom event temba-container-clicked
    - added temba-container-clicked event listener to AttachmentsDropZone
    - added temba-container-clicked event handler to Compose2
    - simplified AttachmentsPicker getActions and replaced div.actions-left, actions-center, and actions-right with div.action-item
    
    - unit test debugging in progress to fix attachments getting mistakenly cleared out when the component is initialized with 1+ attachments
    susanm74 committed May 22, 2023
    Configuration menu
    Copy the full SHA
    3c2b017 View commit details
    Browse the repository at this point in the history
  3. - removed delete icon directly next to img

    - updated styles to remove inner image-item flexbox styling
    susanm74 committed May 22, 2023
    Configuration menu
    Copy the full SHA
    d7362ea View commit details
    Browse the repository at this point in the history

Commits on May 23, 2023

  1. - cleaned up demo page to use image and trash can icons for upload an…

    …d remove
    
    - added temp dupe updateComponent in compose test file to fix compile errors in contact chat test file
    - added configurable property for AttachmentsDropZone drop-mask text
    - added configurable property for AttachmentsUploader upload icon text
    - worked through AttachmentPicker and ImagePicker happy vs error paths to hone in on pre-upload vs. post-upload display
    - adding and updating unit tests in progress
    susanm74 committed May 23, 2023
    Configuration menu
    Copy the full SHA
    634e23d View commit details
    Browse the repository at this point in the history
  2. - commented out failing tests marked with todo's to fix (all related …

    …to the same attachments event listener bug)
    susanm74 committed May 23, 2023
    Configuration menu
    Copy the full SHA
    02e5827 View commit details
    Browse the repository at this point in the history
  3. - updated ImagePicker image render to remove the check for an error a…

    …nd always apply the image-item class stylings
    susanm74 committed May 23, 2023
    Configuration menu
    Copy the full SHA
    75bfd58 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2023

  1. Debugging help

    ericnewcomer committed May 24, 2023
    Configuration menu
    Copy the full SHA
    01e4826 View commit details
    Browse the repository at this point in the history
  2. - removed extra console logs

    susanm74 committed May 24, 2023
    Configuration menu
    Copy the full SHA
    0821a2d View commit details
    Browse the repository at this point in the history
  3. - removed extra quotes surrounding element event handlers ex. @click=…

    …"${}" -> @click=${}
    
    - added min and max file size to AttachmentsUploader... when maxAttachments=1, an error is returned by the uploader... when maxAttachments=1+, the offending files are removed and the remaining files are uploaded
    - added helper method for displaying min max file size errors based on whether one or both are set
    - added temba-field wrapper to ImagePicker to display errors and help_text and eventually to use as a widget inside of RP
    - updated getImage to display the "attachment upload icon" initially, the attached image when populated, or the "attachment error icon" if something during upload failed or went wrong
    - added minFileSize of 2kb and maxFileSize of 500kb to ImagePicker attachments uploader
    susanm74 committed May 24, 2023
    Configuration menu
    Copy the full SHA
    fff7c23 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9ff67fa View commit details
    Browse the repository at this point in the history

Commits on May 25, 2023

  1. - added back compose component to the window's customElements

    - added configurable maxFileSize to AttachmentsPicker (same as the AttachmentsUploader by default)
    - AttachmentsUploader - added default values for uploadIcon, uploadText, maxAttachments, and maxFileSize properties
    - AttachmentsUploader - abstracted pre-upload FileList validation into helper methods
    - AttachmentsUploader - added removeInvalidFiles as an optional param to all validation methods (set to true by default) - when set to true, removes invalid files from the list of valid files to upload, when set to false, adds the invalid files to the this.failedAttachments array
    - AttachmentsUploader - added validation for equal/square file dimensions for when maxAttachments=1
    - AttachmentsUploader - removed getUploadFIleSizeError helper method
    - ImagePicker - using a temp maxFileSize of 200 KB
    - ImagePicker - using temba-field errors instead of helpText for pre-upload errors
    - ImagePicker - removed initial icon display
    susanm74 committed May 25, 2023
    Configuration menu
    Copy the full SHA
    bc5aa9c View commit details
    Browse the repository at this point in the history

Commits on May 27, 2023

  1. - added new 'upload started' custom event

    - added attachments.ts as an attachments-related utils file for upload validation fns
    - added handleUploadValidation to AttachmentsPicker to validate for duplicate files, max attachments, and max file size
    - added InvalidFile and UploadValidationResult interfaces to AttachmentsUploader
    - added validateFiles which gets called before uploadFiles in AttachmentsUploader
    - removed check for failedAttachments when displaying uploadText in AttachmentsUploader
    -  updated line in Compose2 to fix compile err based on attachments-related changes
    - added enum ImageType in ImagePicker for images, avatars, and logos in ImagePicker
    - added style classes for avatars and logos in ImagePicker
    - added handleUploadValidation to ImagePicker
    - ImagePicker getImage updates in progress
    susanm74 committed May 27, 2023
    Configuration menu
    Copy the full SHA
    f086a31 View commit details
    Browse the repository at this point in the history
  2. - added helpText to AttachmentsPicker, Compose2, and ImagePicker

    - added todo's to Compose2 re: necessity of explicitly declaring the widgetOnly and errors props
    susanm74 committed May 27, 2023
    Configuration menu
    Copy the full SHA
    9de8542 View commit details
    Browse the repository at this point in the history

Commits on May 31, 2023

  1. - AttachmentsPicker - commented out redundant base class props

    - AttachmentsUploader - renamed validateFiles to inspectFiles and added todo for getting dimensions inside of inspectFiles
    - Compose2 - commented out redundant base class props
    - ImagePicker - commented out redundant base class props
    susanm74 committed May 31, 2023
    Configuration menu
    Copy the full SHA
    1ce7cab View commit details
    Browse the repository at this point in the history
  2. - AttachmentsUploader - updated inspectFiles to create an array of pr…

    …omises to get the dimensions of each file the user selects to upload
    
    - AttachmentsPicker - updated handleUploadValidation to reuse same uploadValidationResult var across all validation fn's
    - ImagePicker - updated handleUploadValidation to reuse same uploadValidationResult var across all validation fn's
    - attachments - moved UploadFile, InvalidUploadFile, UploadValidationResult, and Attachment interfaces here, added back validateFileDimensions, and added getFileDimensions fn that is called inside of AttachmentsUploader inspectFiles
    - updated demo page
    susanm74 committed May 31, 2023
    Configuration menu
    Copy the full SHA
    0409599 View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2023

  1. - moved ImageType enum into attachments util file

    - updated validateImageDimensions based on imageType
    - renamed customWidth to dropWidth in AttachmentsDropZone
    - removed "Upload Attachments" uploadText from AttachmentsPicker
    - updated AttachmentsUploader to hide uploadText if any files (regardless of success or failure) have been uploaded
    - ImagePicker - created styles based on imageType... switched from using img tag to using a div tag with a background-image url... commented out dropWidth, imageWidth, and imageHeight... now getting width and height based on imageType for image dimension validation in handleUploadValidation... commented out temporary hack in handleAttachmentAdded... added getDropZoneWidth, getDropZoneText, and getImageDimensions helper methods... updated getImage to remove check for this.currentAttachment.error... updated getActions to comment out check for this.currentAttachment.error...
    
    - updates to validation err msgs in progress
    - updates to unit tests in progress
    susanm74 committed Jun 1, 2023
    Configuration menu
    Copy the full SHA
    4b01db8 View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2023

  1. Configuration menu
    Copy the full SHA
    ec4a3bf View commit details
    Browse the repository at this point in the history
  2. - added case switch to getImageDimensions and getDropZoneWidth

    - added dimensions for each image type
    - updated validateImageDimensions err msg to refer to imageType instead of just "File uploads"
    susanm74 committed Jun 5, 2023
    Configuration menu
    Copy the full SHA
    6b630f2 View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2023

  1. Configuration menu
    Copy the full SHA
    2c386cb View commit details
    Browse the repository at this point in the history
  2. - AttachmentsList - got rid of extra check for undefined in updated fn

    - AttachmentsPicker - added child component updates in updated fn... removed child component updates from handleAttachmentsAdded and handleAttachmentsRemoved... removed extra ".bind(this)" from event handler fn's in render fn
    - AttachmentsUploader - got rid of extra check for undefined in updated fn... updated addCurrentAttachment and addFailedAttachment to remove reqquestUpdate() in favor of merging arrays instead of pushing an element into the array
    - Compose2 - removed extra accept properties... added maxFileSize property... added updates to child components in updated fn... added upload validation... removed updates to child components from handleAttachmentAdded and handleAttachmentsRemoved... added dropText to temba-attachments-drop-zone... added maxFileSize to temba-attachments-uploader... removed extra ".bind(this)" from event handler fn's in render fn
    - ContactChat - removed extra ".bind(this)" from event handler fn's in render fn
    - ImagePicker - removed extra dropWidth, imageWidth, and imageHeight properties... added update to child component in updated fn... removed extra ".bind(this)" from event handler fn's in render fn
    - Parent - moved updates to child components from firstUpdated to updated fn
    susanm74 committed Jun 6, 2023
    Configuration menu
    Copy the full SHA
    d073aae View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    49300f3 View commit details
    Browse the repository at this point in the history
  4. - demo - re-ordered tabs and components within tabs

    - AttachmentsDropZone - renamed dropText to uploadText
    - AttachmentsPicker - renamed dropText to uploadText... set default uploadText to ''
    - Compose2 - renamed dropText to uploadText...
    - ImagePicker - renamed dropText to uploadText... renamed getDropZoneText helper fn to getUploadText to reuse across temba-attachments-drop-zone and temba-attachments-uploader... minor maxFileSize property comment cleanup
    susanm74 committed Jun 6, 2023
    Configuration menu
    Copy the full SHA
    ed2c815 View commit details
    Browse the repository at this point in the history
  5. - AttachmentsList - removed some whitespace and some extra requestUpd…

    …ate's
    
    - AttachmentsUploader - minor property cleanup
    - Compose2 - minor property cleanup
    - test-assets - removed 'no image available' jpg
    susanm74 committed Jun 6, 2023
    Configuration menu
    Copy the full SHA
    e3bd1e0 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    0b833b5 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    418f3d2 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2023

  1. Configuration menu
    Copy the full SHA
    a552f1c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a62c7aa View commit details
    Browse the repository at this point in the history
  3. - demo index - based on property updates

    - attachments - got rid of ImageType enum, ImageDimensions, AvatarDimensions, and LogoDimensions... updated validateImageDimensions to validate based on imageWidth and imageHeight
    - AttachmentsDropZone - renamed uploadText to uploadLabel
    - AttachmentsPicker - renamed uploadText to uploadLabel
    - AttachmentsUploader - renamed uploadText to uploadLabel
    - Compose2 - renamed uploadText to uploadLabel
    - ImagePicker - consolidated image styles into .missing-image and .attachment-image... removed imageType, renamed uploadText to uploadLabel, and added back imageWidth, imageHeight, and imageRadius properties... got rid of getImageDimensions... updated getDropZoneWidth and getUploadLabel... updated getImage to add inline border-radius, width, and height
    susanm74 committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    e46d9a9 View commit details
    Browse the repository at this point in the history
  4. - AttachmentsPicker - removed clearing out of currentAttachments and …

    …failedAttachments
    
    - Compose2 - removed clearing out of currentAttachments and failedAttachments
    - ImagePicker - minor updates to whitespace
    susanm74 committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    deec29e View commit details
    Browse the repository at this point in the history
  5. - minor updates to comments

    susanm74 committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    c3011e6 View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2023

  1. - demo index - added compose2 examples to compose tab

    - AttachmentsPicker - moved initialization of children's component properties from updated to firstUpdated... removed failedAttachments from updated fn changes check... added deserialize and serialize fn's...
    - Compose2 - moved initialization of children's component properties from updated to firstUpdated... removed failedAttachments from updated fn changes check...
    - ImagePicker - moved initialization of children's component properties from updated to firstUpdated... removed failedAttachments from updated fn changes check... added deserialize and serialize fn's...
    susanm74 committed Jun 8, 2023
    Configuration menu
    Copy the full SHA
    f27e158 View commit details
    Browse the repository at this point in the history
  2. - minor cleanup to comments

    susanm74 committed Jun 8, 2023
    Configuration menu
    Copy the full SHA
    6193c37 View commit details
    Browse the repository at this point in the history

Commits on Jun 9, 2023

  1. - added initial AttachmentsPicker unit testing

    - added initial ImagePicker unit testing
    - replace Compose with Compose2 (renamed to Compose) and updated unit testing
    
    - todo - validation testing for Compose, AttachmentsPicker, and ImagePicker
    - todo - fix bug where screenshot not displaying ImagePicker success file (just need to update url to point to test-asset)
    - todo - fix bug where screenshot not displaying temba-field errors
    susanm74 committed Jun 9, 2023
    Configuration menu
    Copy the full SHA
    c3e3602 View commit details
    Browse the repository at this point in the history
  2. - demo index - removed extra compose2 components

    - moved upload_endpoint from attachments to AttachmentsUploader
    - Compose - removed extra Attachment interface
    susanm74 committed Jun 9, 2023
    Configuration menu
    Copy the full SHA
    a9dd17f View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2023

  1. - updated attachment picker and image picker unit tests incl. screens…

    …hots
    
    - removed image picker temp hack spoof code
    susanm74 committed Jun 21, 2023
    Configuration menu
    Copy the full SHA
    eed5175 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a84a56e View commit details
    Browse the repository at this point in the history
  3. - simplified screenshot names

    - added attachments uploader unit tests
    - moved getValidAttachments and getInvalidAttachments from attachments picker to attachments uploader
    susanm74 committed Jun 21, 2023
    Configuration menu
    Copy the full SHA
    f641160 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    288e4e0 View commit details
    Browse the repository at this point in the history
  5. - updated attachments list unit tests to add screenshots for before v…

    …s after removing a file
    susanm74 committed Jun 21, 2023
    Configuration menu
    Copy the full SHA
    4b79fc0 View commit details
    Browse the repository at this point in the history
  6. - removed unused import

    susanm74 committed Jun 21, 2023
    Configuration menu
    Copy the full SHA
    d7533eb View commit details
    Browse the repository at this point in the history

Commits on Jun 22, 2023

  1. - removed extra comments

    susanm74 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    fa3cbf1 View commit details
    Browse the repository at this point in the history
  2. - resolving merge conflicts

    susanm74 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    63c2cda View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3862e8a View commit details
    Browse the repository at this point in the history
  4. - updating svg fingerprint

    susanm74 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    cae9af5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d1eaf24 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    7e4f4f9 View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2023

  1. Configuration menu
    Copy the full SHA
    96884bf View commit details
    Browse the repository at this point in the history
  2. - renamed dropWidth to dropZoneWidth

    - simplified image picker unit test screenshot file names
    - added styleMap to pull out ImagePicker .image-item styles from the render template html code
    - abstracted imageMargin for reuse across 1) calculating the drop zone width, and 2) styling the  uploaded image (both the missing image or the uploaded one)
    susanm74 committed Jun 23, 2023
    Configuration menu
    Copy the full SHA
    0197815 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    30cc9ec View commit details
    Browse the repository at this point in the history

Commits on Jun 29, 2023

  1. Configuration menu
    Copy the full SHA
    c698985 View commit details
    Browse the repository at this point in the history