Skip to content

Commit

Permalink
remove router scroll tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnaceMaes committed Aug 22, 2024
1 parent eb12a4f commit 2341a6d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 11 deletions.
4 changes: 0 additions & 4 deletions app/components/pokemon-evolution-nav.gts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { service } from '@ember/service';
import { fn } from '@ember/helper';
import { on } from '@ember/modifier';
import { preloadImage } from 'ember-polaris-pokedex/components/pokemon-grid-item';
import { type RouterScrollService } from 'ember-polaris-pokedex/utils/router-scroll-service';

export function getPokemonById(pokemons: PokemonModel[], id: string) {
return pokemons.find((pokemon) => pokemon.id!.toString() === id);
Expand All @@ -17,13 +16,10 @@ export default class PokemonEvolutionNav extends Component<{
}> {
@service declare router: RouterService;

@service declare routerScroll: RouterScrollService;

transitionToPokemonDetails = (
pokemonId: string,
direction: 'forwards' | 'backwards',
) => {
this.routerScroll.preserveScrollPosition = true;
// Fallback for browsers that don't support this API:
if (!document.startViewTransition) {
this.router.transitionTo('pokemon.pokemon', pokemonId.toString());
Expand Down
4 changes: 0 additions & 4 deletions app/components/pokemon-grid-item.gts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Component from '@glimmer/component';
import type PokemonModel from 'ember-polaris-pokedex/models/pokemon';
import { service } from '@ember/service';
import type RouterService from '@ember/routing/router-service';
import { type RouterScrollService } from 'ember-polaris-pokedex/utils/router-scroll-service';

export function preloadImage(imageUrl: string) {
const img = new Image();
Expand All @@ -18,10 +17,7 @@ interface PokemonSignature {
export default class PokemonGridItem extends Component<PokemonSignature> {
@service declare router: RouterService;

@service declare routerScroll: RouterScrollService;

transitionToPokemonDetails = (pokemon: PokemonModel, event: MouseEvent) => {
this.routerScroll.preserveScrollPosition = false;
// Fallback for browsers that don't support this API:
if (!document.startViewTransition) {
this.router.transitionTo('pokemon.pokemon', pokemon.id?.toString());
Expand Down
3 changes: 0 additions & 3 deletions app/utils/router-scroll-service.ts

This file was deleted.

0 comments on commit 2341a6d

Please sign in to comment.