forked from cory/tildefriends
		
	Add an emoji of the day to gg, and add a tropical fish for reasons.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4567 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "type": "tildefriends-app",
 | 
			
		||||
  "emoji": "🗺"
 | 
			
		||||
  "emoji": "🗺",
 | 
			
		||||
  "previous": "&0XSp+xdQwVtQ88bXzvWdH15Ex63hv5zUKTa4zx7HBGM=.sha256"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1
									
								
								apps/gg/emojis.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								apps/gg/emojis.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -19,6 +19,7 @@ const k_store = {
 | 
			
		||||
	'🛶': 10,
 | 
			
		||||
	'🏠': 10,
 | 
			
		||||
	'⛰': 10,
 | 
			
		||||
	'🐠': 10,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const k_marker_snap = {x: 5, y: 4};
 | 
			
		||||
@@ -37,6 +38,7 @@ class GgAppElement extends LitElement {
 | 
			
		||||
			url: {type: String},
 | 
			
		||||
			currency: {type: Number},
 | 
			
		||||
			to_build: {type: String},
 | 
			
		||||
			emoji_of_the_day: {type: String},
 | 
			
		||||
		};
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -62,6 +64,11 @@ class GgAppElement extends LitElement {
 | 
			
		||||
 | 
			
		||||
	async load() {
 | 
			
		||||
		console.log('load');
 | 
			
		||||
		let emojis = await (await fetch('emojis.json')).json();
 | 
			
		||||
		emojis = Object.values(emojis).map(x => Object.values(x)).flat();
 | 
			
		||||
		let today = new Date();
 | 
			
		||||
		let date_index = today.getYear() * 356 + today.getMonth() * 31 + today.getDate();
 | 
			
		||||
		this.emoji_of_the_day = emojis[(date_index * 123457) % emojis.length];
 | 
			
		||||
		this.user = await tfrpc.rpc.getUser();
 | 
			
		||||
		this.url = (await tfrpc.rpc.url()).split('?')[0];
 | 
			
		||||
		try {
 | 
			
		||||
@@ -713,10 +720,12 @@ class GgAppElement extends LitElement {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	render_store() {
 | 
			
		||||
		let store = Object.assign({}, k_store);
 | 
			
		||||
		store[this.emoji_of_the_day] = 5;
 | 
			
		||||
		return html`
 | 
			
		||||
			<h2>Store</h2>
 | 
			
		||||
			<div><b>Your balance:</b> ${this.currency}</div>
 | 
			
		||||
			${Object.entries(k_store).map(this.render_store_item.bind(this))}
 | 
			
		||||
			${Object.entries(store).map(this.render_store_item.bind(this))}
 | 
			
		||||
		`;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user