File size: 2,299 Bytes
7d44b67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Shared utility functions
class ComicUtils {
    static async fetchComicTemplates() {
        try {
            // In a real app, this would fetch from an API
            return [
                { id: 1, name: 'Classic Panel', thumbnail: 'http://static.photos/education/320x240/1' },
                { id: 2, name: 'Dynamic Layout', thumbnail: 'http://static.photos/education/320x240/2' },
                { id: 3, name: 'Splash Page', thumbnail: 'http://static.photos/education/320x240/3' },
                { id: 4, name: 'Strip Layout', thumbnail: 'http://static.photos/education/320x240/4' },
                { id: 5, name: 'Grid Style', thumbnail: 'http://static.photos/education/320x240/5' },
                { id: 6, name: 'Custom Design', thumbnail: 'http://static.photos/education/320x240/6' }
            ];
        } catch (error) {
            console.error('Error fetching templates:', error);
            return [];
        }
    }

    static getTemplateById(id) {
        const templates = [
            { id: 1, name: 'Classic Panel', layout: 'single', thumbnail: 'http://static.photos/education/320x240/1' },
            { id: 2, name: 'Dynamic Layout', layout: 'dynamic', thumbnail: 'http://static.photos/education/320x240/2' },
            { id: 3, name: 'Splash Page', layout: 'splash', thumbnail: 'http://static.photos/education/320x240/3' },
            { id: 4, name: 'Strip Layout', layout: 'strip', thumbnail: 'http://static.photos/education/320x240/4' },
            { id: 5, name: 'Grid Style', layout: 'grid', thumbnail: 'http://static.photos/education/320x240/5' },
            { id: 6, name: 'Custom Design', layout: 'custom', thumbnail: 'http://static.photos/education/320x240/6' }
        ];
        return templates.find(t => t.id === parseInt(id));
    }

    static saveComic(comicData) {
        let comics = JSON.parse(localStorage.getItem('userComics')) || [];
        comics.unshift(comicData);
        localStorage.setItem('userComics', JSON.stringify(comics));
    }

    static getRecentComics(limit = 3) {
        const comics = JSON.parse(localStorage.getItem('userComics')) || [];
        return comics.slice(0, limit);
    }
}

// Initialize feather icons on page load
document.addEventListener('DOMContentLoaded', () => {
    feather.replace();
});