use LocationAssetType (#7965)

* use LocationAssetType

Signed-off-by: Kerry Archibald <kerrya@element.io>

* center icon better

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove debug

Signed-off-by: Kerry Archibald <kerrya@element.io>

* retrigger all builds

Signed-off-by: Kerry Archibald <kerrya@element.io>
pull/21833/head
Kerry 2022-03-03 11:04:38 +01:00 committed by GitHub
parent 3572b36648
commit 7aefa34420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -58,12 +58,11 @@ limitations under the License.
.mx_MLocationBody_markerContents { .mx_MLocationBody_markerContents {
background-color: $location-marker-color; background-color: $location-marker-color;
margin: 4px; margin: 0;
width: 24px; width: 31px;
height: 24px; height: 31px;
padding-top: 8px;
mask-repeat: no-repeat; mask-repeat: no-repeat;
mask-size: contain; mask-size: 16px;
mask-position: center; mask-position: center;
mask-image: url('$(res)/img/element-icons/location.svg'); mask-image: url('$(res)/img/element-icons/location.svg');
} }

View File

@ -20,7 +20,7 @@ import { logger } from "matrix-js-sdk/src/logger";
import { MatrixEvent } from 'matrix-js-sdk/src/models/event'; import { MatrixEvent } from 'matrix-js-sdk/src/models/event';
import { import {
ASSET_NODE_TYPE, ASSET_NODE_TYPE,
ASSET_TYPE_SELF, LocationAssetType,
ILocationContent, ILocationContent,
LOCATION_EVENT_TYPE, LOCATION_EVENT_TYPE,
} from 'matrix-js-sdk/src/@types/location'; } from 'matrix-js-sdk/src/@types/location';
@ -130,8 +130,8 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
export function isSelfLocation(locationContent: ILocationContent): boolean { export function isSelfLocation(locationContent: ILocationContent): boolean {
const asset = ASSET_NODE_TYPE.findIn(locationContent) as { type: string }; const asset = ASSET_NODE_TYPE.findIn(locationContent) as { type: string };
const assetType = asset?.type ?? ASSET_TYPE_SELF; const assetType = asset?.type ?? LocationAssetType.Self;
return assetType == ASSET_TYPE_SELF; return assetType == LocationAssetType.Self;
} }
interface ILocationBodyContentProps { interface ILocationBodyContentProps {

View File

@ -17,6 +17,7 @@ limitations under the License.
import { makeLocationContent } from "matrix-js-sdk/src/content-helpers"; import { makeLocationContent } from "matrix-js-sdk/src/content-helpers";
import { import {
ASSET_NODE_TYPE, ASSET_NODE_TYPE,
LocationAssetType,
ILocationContent, ILocationContent,
LOCATION_EVENT_TYPE, LOCATION_EVENT_TYPE,
TIMESTAMP_NODE_TYPE, TIMESTAMP_NODE_TYPE,
@ -235,7 +236,7 @@ describe("MLocationBody", () => {
}); });
it("Returns false for an unknown asset type", () => { it("Returns false for an unknown asset type", () => {
const content = makeLocationContent("", "", 0, "", "org.example.unknown"); const content = makeLocationContent("", "", 0, "", "org.example.unknown" as unknown as LocationAssetType);
expect(isSelfLocation(content)).toBe(false); expect(isSelfLocation(content)).toBe(false);
}); });
}); });