Skip to content

Commit

Permalink
Merge branch 'main' into ts-migration/workflow-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VickyStash committed Mar 25, 2024
2 parents 7b8d0a2 + d20d40c commit 0f90985
Show file tree
Hide file tree
Showing 83 changed files with 801 additions and 889 deletions.
81 changes: 0 additions & 81 deletions docs/articles/expensify-classic/expenses/Distance-Tracking.md

This file was deleted.

66 changes: 66 additions & 0 deletions docs/articles/expensify-classic/expenses/Track-mileage-expenses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: Track mileage expenses
description: Add mileage-related expenses
---

<div id="expensify-classic" markdown="1">

You can track your mileage-related expenses by logging your trips in Expensify. You have a couple of different options for logging distance:

- Web app:
- **Manually create**: Manually enter the number of miles for the trip
- **Create from map**: Automatically determine the trip distance based on the start and end location.
- Mobile app:
- **Manually create**: Manually enter the miles for the trip and your mileage rate
- **Odometer**: Enter your odometer reading before and after the trip
- **Start GPS**: Currently under development and unavailable for use.

{% include info.html %}
When adding a distance expense, the rates available are determined by the rates set in your workspace rate settings. To update these rates or add a new rate, you must be a Workspace Admin.
{% include end-info.html %}

{% include selector.html values="desktop, mobile" %}

{% include option.html value="desktop" %}

1. Click the **Expenses** tab.
2. Click **New Expense**.
3. Select the expense type.
- **Manually create**:
- Enter the number of miles for the trip.
- Select your rate.
- If desired, select the category, add a description, or select a report to add the expense to.
- Click **Save**.
- **Create from map**:
- Add your start location as point A.
- Add your end location as point B.
- If applicable, click **Add Destination** to add additional stops.
- To generate a map receipt, leave the Create Receipt checkbox selected.
- Click **Save**.
- Select your rate.
- If desired, select the category, add a description, or select a report to add the expense to.
- Click **Save**.

{% include end-option.html %}

{% include option.html value="mobile" %}

1. Click the + icon in the top right corner.
2. Under the Distance section, select the expense type.
- **Manually create**:
- Enter your mileage.
- Select your rate.
- If desired, click **More Options** to select the category, add a description, or select a report to add the expense to.
- Click **Save**.
- **Odometer**:
- Enter your vehicle’s odometer reading before the trip.
- Enter your vehicle’s odometer reading after the trip.
- Select your rate.
- If desired, click **More Options** to select the category, add a description, or select a report to add the expense to.
- Click **Save**.
{% include end-option.html %}

{% include end-selector.html %}

</div>

71 changes: 0 additions & 71 deletions docs/articles/expensify-classic/settings/Copilot.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: Change member workspace roles
description: Update a member's role for a workspace
---
<div id="expensify-classic" markdown="1">

To change the roles and permissions for members of your workspace,

1. Hover over Settings, then click **Workspaces**.
2. Click the **Group** tab on the left.
3. Click the desired workspace name.
4. Click the **Members** tab on the left.
5. Click the Settings icon next to the desired member.
6. Select a new role for the member.

| | Employee | Auditor | Workspace Admin |
|---------------------------|----------------------------------|---------|-----------------|
| Submit reports | Yes | Yes | Yes |
| Comment on reports | Yes | Yes | Yes |
| Approve workspace reports | Only reports submitted to them | Yes | Yes |
| Edit workspace settings | No | No | Yes |

7. If your workspace uses Advanced Approvals, select an “Approves to.” This determines who the member’s reports must be approved by, if applicable. If “no one” is selected, then any one with the Auditor or Workspace Admin role can approve the member’s reports.
8. Click **Save**.

</div>
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ const CONST = {
TRACK_EXPENSE: 'trackExpense',
P2P_DISTANCE_REQUESTS: 'p2pDistanceRequests',
WORKFLOWS_DELAYED_SUBMISSION: 'workflowsDelayedSubmission',
ACCOUNTING: 'accounting',
},
BUTTON_STATES: {
DEFAULT: 'default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ function BaseAnchorForAttachmentsOnly({style, source = '', displayName = '', dow
role={CONST.ROLE.BUTTON}
>
<AttachmentView
// @ts-expect-error TODO: Remove this once AttachmentView (https://github.com/Expensify/App/issues/25150) is migrated to TypeScript.
source={sourceURLWithAuth}
file={{name: displayName}}
shouldShowDownloadIcon={!isOffline}
Expand Down
30 changes: 10 additions & 20 deletions src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import type ModalType from '@src/types/utils/ModalType';
import AttachmentCarousel from './Attachments/AttachmentCarousel';
import AttachmentCarouselPagerContext from './Attachments/AttachmentCarousel/Pager/AttachmentCarouselPagerContext';
import AttachmentView from './Attachments/AttachmentView';
import type {Attachment} from './Attachments/types';
import BlockingView from './BlockingViews/BlockingView';
import Button from './Button';
import ConfirmModal from './ConfirmModal';
Expand Down Expand Up @@ -61,15 +62,6 @@ type AttachmentModalOnyxProps = {
parentReportActions: OnyxEntry<OnyxTypes.ReportActions>;
};

type Attachment = {
source: AvatarSource;
isAuthTokenRequired: boolean;
file: FileObject;
isReceipt: boolean;
hasBeenFlagged?: boolean;
reportActionID?: string;
};

type ImagePickerResponse = {
height: number;
name: string;
Expand All @@ -79,7 +71,7 @@ type ImagePickerResponse = {
width: number;
};

type FileObject = File | ImagePickerResponse;
type FileObject = Partial<File | ImagePickerResponse>;

type ChildrenProps = {
displayFileInModal: (data: FileObject) => void;
Expand Down Expand Up @@ -181,7 +173,7 @@ function AttachmentModal({
const [isAuthTokenRequiredState, setIsAuthTokenRequiredState] = useState(isAuthTokenRequired);
const [attachmentInvalidReasonTitle, setAttachmentInvalidReasonTitle] = useState<TranslationPaths | null>(null);
const [attachmentInvalidReason, setAttachmentInvalidReason] = useState<TranslationPaths | null>(null);
const [sourceState, setSourceState] = useState(() => source);
const [sourceState, setSourceState] = useState<AvatarSource>(() => source);
const [modalType, setModalType] = useState<ModalType>(CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE);
const [isConfirmButtonDisabled, setIsConfirmButtonDisabled] = useState(false);
const [confirmButtonFadeAnimation] = useState(() => new Animated.Value(1));
Expand All @@ -190,7 +182,7 @@ function AttachmentModal({
const {windowWidth, isSmallScreenWidth} = useWindowDimensions();
const isOverlayModalVisible = (isReceiptAttachment && isDeleteReceiptConfirmModalVisible) || (!isReceiptAttachment && isAttachmentInvalid);

const [file, setFile] = useState<Partial<FileObject> | undefined>(
const [file, setFile] = useState<FileObject | undefined>(
originalFileName
? {
name: originalFileName,
Expand All @@ -211,7 +203,7 @@ function AttachmentModal({
(attachment: Attachment) => {
setSourceState(attachment.source);
setFile(attachment.file);
setIsAuthTokenRequiredState(attachment.isAuthTokenRequired);
setIsAuthTokenRequiredState(attachment.isAuthTokenRequired ?? false);
onCarouselAttachmentChange(attachment);
},
[onCarouselAttachmentChange],
Expand All @@ -222,7 +214,7 @@ function AttachmentModal({
*/
const getModalType = useCallback(
(sourceURL: string, fileObject: FileObject) =>
sourceURL && (Str.isPDF(sourceURL) || (fileObject && Str.isPDF(fileObject.name || translate('attachmentView.unknownFilename'))))
sourceURL && (Str.isPDF(sourceURL) || (fileObject && Str.isPDF(fileObject.name ?? translate('attachmentView.unknownFilename'))))
? CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE
: CONST.MODAL.MODAL_TYPE.CENTERED,
[translate],
Expand Down Expand Up @@ -292,14 +284,14 @@ function AttachmentModal({
}, [transaction, report]);

const isValidFile = useCallback((fileObject: FileObject) => {
if (fileObject.size > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) {
if (fileObject.size !== undefined && fileObject.size > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) {
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooLarge');
setAttachmentInvalidReason('attachmentPicker.sizeExceeded');
return false;
}

if (fileObject.size < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) {
if (fileObject.size !== undefined && fileObject.size < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) {
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooSmall');
setAttachmentInvalidReason('attachmentPicker.sizeNotMet');
Expand Down Expand Up @@ -352,7 +344,7 @@ function AttachmentModal({
setSourceState(inputSource);
setFile(updatedFile);
setModalType(inputModalType);
} else {
} else if (fileObject.uri) {
const inputModalType = getModalType(fileObject.uri, fileObject);
setIsModalOpen(true);
setSourceState(fileObject.uri);
Expand Down Expand Up @@ -536,7 +528,6 @@ function AttachmentModal({
onNavigate={onNavigate}
onClose={closeModal}
source={source}
onToggleKeyboard={updateConfirmButtonVisibility}
setDownloadButtonVisibility={setDownloadButtonVisibility}
/>
) : (
Expand All @@ -546,7 +537,6 @@ function AttachmentModal({
!shouldShowNotFoundPage && (
<AttachmentCarouselPagerContext.Provider value={context}>
<AttachmentView
// @ts-expect-error TODO: Remove this once Attachments (https://github.com/Expensify/App/issues/24969) is migrated to TypeScript.
containerStyles={[styles.mh5]}
source={sourceForAttachmentView}
isAuthTokenRequired={isAuthTokenRequiredState}
Expand Down Expand Up @@ -637,4 +627,4 @@ export default withOnyx<AttachmentModalProps, AttachmentModalOnyxProps>({
},
})(memo(AttachmentModal));

export type {Attachment, FileObject};
export type {FileObject};
Loading

0 comments on commit 0f90985

Please sign in to comment.